morpheus-cli 5.0.2 → 5.2.0

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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morpheus-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Estes
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-10-23 00:00:00.000000000 Z
14
+ date: 2020-11-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -279,6 +279,7 @@ files:
279
279
  - lib/morpheus/api/security_groups_interface.rb
280
280
  - lib/morpheus/api/server_types_interface.rb
281
281
  - lib/morpheus/api/servers_interface.rb
282
+ - lib/morpheus/api/service_catalog_interface.rb
282
283
  - lib/morpheus/api/service_plans_interface.rb
283
284
  - lib/morpheus/api/setup_interface.rb
284
285
  - lib/morpheus/api/storage_providers_interface.rb
@@ -310,7 +311,7 @@ files:
310
311
  - lib/morpheus/cli/blueprints_command.rb
311
312
  - lib/morpheus/cli/boot_scripts_command.rb
312
313
  - lib/morpheus/cli/budgets_command.rb
313
- - lib/morpheus/cli/catalog_command.rb
314
+ - lib/morpheus/cli/catalog_item_types_command.rb
314
315
  - lib/morpheus/cli/change_password_command.rb
315
316
  - lib/morpheus/cli/cli_command.rb
316
317
  - lib/morpheus/cli/cli_registry.rb
@@ -388,7 +389,6 @@ files:
388
389
  - lib/morpheus/cli/logs_command.rb
389
390
  - lib/morpheus/cli/mixins/accounts_helper.rb
390
391
  - lib/morpheus/cli/mixins/backups_helper.rb
391
- - lib/morpheus/cli/mixins/catalog_helper.rb
392
392
  - lib/morpheus/cli/mixins/deployments_helper.rb
393
393
  - lib/morpheus/cli/mixins/infrastructure_helper.rb
394
394
  - lib/morpheus/cli/mixins/library_helper.rb
@@ -435,6 +435,7 @@ files:
435
435
  - lib/morpheus/cli/search_command.rb
436
436
  - lib/morpheus/cli/security_group_rules.rb
437
437
  - lib/morpheus/cli/security_groups.rb
438
+ - lib/morpheus/cli/service_catalog_command.rb
438
439
  - lib/morpheus/cli/service_plans_command.rb
439
440
  - lib/morpheus/cli/setup.rb
440
441
  - lib/morpheus/cli/shell.rb
@@ -1,66 +0,0 @@
1
- require 'morpheus/cli/mixins/print_helper'
2
- # Mixin for Morpheus::Cli command classes
3
- # Provides common methods for infrastructure management
4
- module Morpheus::Cli::CatalogHelper
5
-
6
- def self.included(klass)
7
- klass.send :include, Morpheus::Cli::PrintHelper
8
- end
9
-
10
- def catalog_item_types_interface
11
- raise "#{self.class} has not defined @catalog_item_types_interface" if @catalog_item_types_interface.nil?
12
- @catalog_item_types_interface
13
- end
14
-
15
- # def service_catalog_interface
16
- # raise "#{self.class} has not defined @service_catalog_interface" if @service_catalog_interface.nil?
17
- # @service_catalog_interface
18
- # end
19
-
20
- def catalog_item_type_object_key
21
- 'catalogItemType'
22
- end
23
-
24
- def catalog_item_type_list_key
25
- 'catalogItemTypes'
26
- end
27
-
28
- def find_catalog_item_type_by_name_or_id(val)
29
- if val.to_s =~ /\A\d{1,}\Z/
30
- return find_catalog_item_type_by_id(val)
31
- else
32
- return find_catalog_item_type_by_name(val)
33
- end
34
- end
35
-
36
- def find_catalog_item_type_by_id(id)
37
- begin
38
- json_response = catalog_item_types_interface.get(id.to_i)
39
- return json_response[catalog_item_type_object_key]
40
- rescue RestClient::Exception => e
41
- if e.response && e.response.code == 404
42
- print_red_alert "catalog_item_type not found by id '#{id}'"
43
- else
44
- raise e
45
- end
46
- end
47
- end
48
-
49
- def find_catalog_item_type_by_name(name)
50
- json_response = catalog_item_types_interface.list({name: name.to_s})
51
- catalog_item_types = json_response[catalog_item_type_list_key]
52
- if catalog_item_types.empty?
53
- print_red_alert "catalog_item_type not found by name '#{name}'"
54
- return nil
55
- elsif catalog_item_types.size > 1
56
- print_red_alert "#{catalog_item_types.size} catalog_item_types found by name '#{name}'"
57
- puts_error as_pretty_table(catalog_item_types, [:id, :name], {color:red})
58
- print_red_alert "Try using ID instead"
59
- print reset,"\n"
60
- return nil
61
- else
62
- return catalog_item_types[0]
63
- end
64
- end
65
-
66
- end