morpheus-cli 5.4.4.2 → 5.5.0

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
  SHA256:
3
- metadata.gz: 035407b70b8d466e8167c8c82dcc564c1b1ec3890411efc1f0cada46f29b5fb7
4
- data.tar.gz: 1af6373e32fd55e17031919e958987c3928f3cc9dd1537bdd03fa245f5d41c63
3
+ metadata.gz: ca02ec5cffb310afe4458568f745332e8f81f1d03a525ad1a9d9d1a3ecd08313
4
+ data.tar.gz: 323d4e3627c67fbd676bb34eb0b6f62b0eecff6180285af93599aba21f0a9781
5
5
  SHA512:
6
- metadata.gz: 5635c593c0a181fab9635275458448336b593f87462e53586b5caf6d255710d3fcb2e749772b6a03ff68e3362a73c7e764e4df408dd3b8b7cd7a5bc0082e3e85
7
- data.tar.gz: 10eb5b76228b348d8734c48014687a91adb2fece61d63905bdea17699b3d0a2751e3d509f12fe77e78871cf954c3bfe22443d48feb43d8af8da698d77a037f24
6
+ metadata.gz: bc72cdba318abc74aef8dec7ab8602ad7ec7196101950dfc0b29b8fe8c4298c2de5b41265a386457c38fa0ac9e46082cb86d04d7cfbc75652a1824d5a036cec1
7
+ data.tar.gz: f546fe9ed24fcc380d8aa1f2fc6d05a1cfb7186dcee48e66c340c51951b69e3b04408db5400ddcb23c9c596ccb14867571f1e21b6ceeb3e253c720d0525c21b0
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  FROM ruby:2.5.1
2
2
 
3
- RUN gem install morpheus-cli -v 5.4.4.1
3
+ RUN gem install morpheus-cli -v 5.5.0
4
4
 
5
5
  ENTRYPOINT ["morpheus"]
@@ -57,20 +57,34 @@ class Morpheus::AppsInterface < Morpheus::APIClient
57
57
  execute(opts)
58
58
  end
59
59
 
60
- def apply(app_id, params, payload)
61
- url = "#{@base_url}/api/apps/#{app_id}/apply"
60
+ def prepare_apply(app_id, params={})
61
+ url = "#{@base_url}/api/apps/#{app_id}/prepare-apply"
62
+ headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
63
+ opts = {method: :get, url: url, headers: headers}
64
+ execute(opts)
65
+ end
66
+
67
+ def validate_apply(app_id, params, payload)
68
+ url = "#{@base_url}/api/apps/#{app_id}/validate-apply"
62
69
  headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
63
70
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
64
71
  execute(opts)
65
72
  end
66
73
 
67
- def prepare_apply(app_id, params, payload)
68
- url = "#{@base_url}/api/apps/#{app_id}/prepare-apply"
74
+ def apply(app_id, params, payload)
75
+ url = "#{@base_url}/api/apps/#{app_id}/apply"
69
76
  headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
70
77
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
71
78
  execute(opts)
72
79
  end
73
80
 
81
+ def state(id, params={})
82
+ url = "#{@base_url}/api/apps/#{id}/state"
83
+ headers = { params: params, authorization: "Bearer #{@access_token}" }
84
+ opts = {method: :get, url: url, headers: headers}
85
+ execute(opts)
86
+ end
87
+
74
88
  def add_instance(app_id, payload)
75
89
  url = "#{@base_url}/api/apps/#{app_id}/add-instance"
76
90
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
@@ -379,6 +379,20 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
379
379
  execute(opts)
380
380
  end
381
381
 
382
+ def prepare_apply(id, params={})
383
+ url = "#{@base_url}/api/instances/#{id}/prepare-apply"
384
+ headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
385
+ opts = {method: :get, url: url, headers: headers}
386
+ execute(opts)
387
+ end
388
+
389
+ def validate_apply(id, params, payload)
390
+ url = "#{@base_url}/api/instances/#{id}/validate-apply"
391
+ headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
392
+ opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
393
+ execute(opts)
394
+ end
395
+
382
396
  def apply(id, params, payload)
383
397
  url = "#{@base_url}/api/instances/#{id}/apply"
384
398
  headers = {:params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
@@ -386,8 +400,8 @@ class Morpheus::InstancesInterface < Morpheus::APIClient
386
400
  execute(opts)
387
401
  end
388
402
 
389
- def state_summary(id, params={})
390
- url = "#{@base_url}/api/instances/#{id}/state-summary"
403
+ def state(id, params={})
404
+ url = "#{@base_url}/api/instances/#{id}/state"
391
405
  headers = { params: params, authorization: "Bearer #{@access_token}" }
392
406
  opts = {method: :get, url: url, headers: headers}
393
407
  execute(opts)
@@ -62,4 +62,10 @@ class Morpheus::PricesInterface < Morpheus::APIClient
62
62
  headers = { params: params, authorization: "Bearer #{@access_token}" }
63
63
  execute(method: :get, url: url, headers: headers)
64
64
  end
65
+
66
+ def list_currencies(params={})
67
+ url = "#{base_path}/currencies"
68
+ headers = { params: params, authorization: "Bearer #{@access_token}" }
69
+ execute(method: :get, url: url, headers: headers)
70
+ end
65
71
  end
@@ -253,7 +253,7 @@ module Morpheus
253
253
 
254
254
  # list is GET that supports phrase,max,offset,sort,direction
255
255
  def build_standard_list_options(opts, options, includes=[], excludes=[])
256
- build_standard_get_options(opts, options, [:list] + includes, excludes=[])
256
+ build_standard_get_options(opts, options, [:list] + includes, excludes)
257
257
  end
258
258
 
259
259
  def build_standard_add_options(opts, options, includes=[], excludes=[])
@@ -1569,7 +1569,7 @@ module Morpheus
1569
1569
  #Morpheus::Logging::DarkPrinter.puts "find_all(#{args.join(', ')})" if Morpheus::Logging.debug?
1570
1570
  type, *request_args = args
1571
1571
  type = type.to_s.singularize.underscore
1572
- list_key = respond_to?("#{type}_list_key", true) ? send("#{type}_list_key") : type.camelcase.pluralize
1572
+ list_key = respond_to?("#{type}_list_key", true) ? send("#{type}_list_key") : get_list_key(type)
1573
1573
  json_response = find_all_json(*args)
1574
1574
  if !json_response.key?(list_key)
1575
1575
  # maybe just use the first key like this:
@@ -1600,7 +1600,7 @@ module Morpheus
1600
1600
  #Morpheus::Logging::DarkPrinter.puts "find_record(#{args.join(', ')})" if Morpheus::Logging.debug?
1601
1601
  type, *request_args = args
1602
1602
  type = type.to_s.singularize.underscore
1603
- object_key = respond_to?("#{type}_object_key", true) ? send("#{type}_object_key") : type.camelcase.singularize
1603
+ object_key = respond_to?("#{type}_object_key", true) ? send("#{type}_object_key") : get_object_key(type)
1604
1604
  json_response = find_record_json(*args)
1605
1605
  if !json_response.key?(object_key)
1606
1606
  # maybe just use the first key like this:
@@ -1645,6 +1645,19 @@ module Morpheus
1645
1645
  return interface
1646
1646
  end
1647
1647
 
1648
+ def get_list_key(type)
1649
+ return get_object_key(type).pluralize
1650
+ end
1651
+
1652
+ def get_object_key(type)
1653
+ key = type.camelcase.singularize
1654
+ # add aliases here as needed
1655
+ if key == "cloud"
1656
+ key = "zone"
1657
+ end
1658
+ return key
1659
+ end
1660
+
1648
1661
  module ClassMethods
1649
1662
 
1650
1663
  def prog_name