morpheus-cli 5.3.2.3 → 5.4.1

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.
Files changed (212) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +1 -1
  3. data/lib/morpheus/api/account_users_interface.rb +68 -0
  4. data/lib/morpheus/api/api_client.rb +75 -8
  5. data/lib/morpheus/api/audit_interface.rb +9 -0
  6. data/lib/morpheus/api/clouds_interface.rb +4 -11
  7. data/lib/morpheus/api/health_interface.rb +37 -3
  8. data/lib/morpheus/api/instances_interface.rb +39 -5
  9. data/lib/morpheus/api/load_balancer_monitors_interface.rb +9 -0
  10. data/lib/morpheus/api/load_balancer_profiles_interface.rb +9 -0
  11. data/lib/morpheus/api/load_balancer_virtual_servers_interface.rb +9 -0
  12. data/lib/morpheus/api/load_balancers_interface.rb +5 -0
  13. data/lib/morpheus/api/network_dhcp_relays_interface.rb +36 -0
  14. data/lib/morpheus/api/network_dhcp_servers_interface.rb +36 -0
  15. data/lib/morpheus/api/network_edge_clusters_interface.rb +26 -0
  16. data/lib/morpheus/api/network_routers_interface.rb +30 -0
  17. data/lib/morpheus/api/network_servers_interface.rb +98 -0
  18. data/lib/morpheus/api/network_static_routes_interface.rb +36 -0
  19. data/lib/morpheus/api/read_interface.rb +4 -3
  20. data/lib/morpheus/api/rest_interface.rb +5 -4
  21. data/lib/morpheus/api/roles_interface.rb +7 -0
  22. data/lib/morpheus/api/secondary_read_interface.rb +1 -1
  23. data/lib/morpheus/api/secondary_rest_interface.rb +19 -19
  24. data/lib/morpheus/api/storage_server_types_interface.rb +14 -0
  25. data/lib/morpheus/api/storage_servers_interface.rb +9 -0
  26. data/lib/morpheus/api/storage_volume_types_interface.rb +9 -0
  27. data/lib/morpheus/api/storage_volumes_interface.rb +9 -0
  28. data/lib/morpheus/api/users_interface.rb +16 -63
  29. data/lib/morpheus/api/virtual_images_interface.rb +23 -2
  30. data/lib/morpheus/api/virtual_servers_interface.rb +9 -0
  31. data/lib/morpheus/cli/cli_command.rb +274 -19
  32. data/lib/morpheus/cli/cli_registry.rb +56 -2
  33. data/lib/morpheus/cli/{access_token_command.rb → commands/access_token_command.rb} +1 -1
  34. data/lib/morpheus/cli/{account_groups_command.rb → commands/account_groups_command.rb} +0 -8
  35. data/lib/morpheus/cli/{activity_command.rb → commands/activity_command.rb} +0 -0
  36. data/lib/morpheus/cli/commands/{standard/alias_command.rb → alias_command.rb} +1 -4
  37. data/lib/morpheus/cli/{appliance_settings_command.rb → commands/appliance_settings_command.rb} +0 -0
  38. data/lib/morpheus/cli/{approvals_command.rb → commands/approvals_command.rb} +0 -0
  39. data/lib/morpheus/cli/{apps.rb → commands/apps.rb} +17 -89
  40. data/lib/morpheus/cli/{archives_command.rb → commands/archives_command.rb} +0 -6
  41. data/lib/morpheus/cli/commands/audit.rb +188 -0
  42. data/lib/morpheus/cli/{backup_jobs_command.rb → commands/backup_jobs_command.rb} +0 -0
  43. data/lib/morpheus/cli/{backup_settings_command.rb → commands/backup_settings_command.rb} +0 -0
  44. data/lib/morpheus/cli/{backups_command.rb → commands/backups_command.rb} +0 -0
  45. data/lib/morpheus/cli/commands/{standard/benchmark_command.rb → benchmark_command.rb} +0 -3
  46. data/lib/morpheus/cli/{blueprints_command.rb → commands/blueprints_command.rb} +1 -1
  47. data/lib/morpheus/cli/{boot_scripts_command.rb → commands/boot_scripts_command.rb} +0 -3
  48. data/lib/morpheus/cli/{budgets_command.rb → commands/budgets_command.rb} +0 -0
  49. data/lib/morpheus/cli/commands/{standard/cat_command.rb → cat_command.rb} +0 -0
  50. data/lib/morpheus/cli/{catalog_item_types_command.rb → commands/catalog_item_types_command.rb} +0 -0
  51. data/lib/morpheus/cli/{certificates_command.rb → commands/certificates_command.rb} +0 -0
  52. data/lib/morpheus/cli/commands/change_password_command.rb +132 -0
  53. data/lib/morpheus/cli/{cloud_datastores_command.rb → commands/cloud_datastores_command.rb} +0 -4
  54. data/lib/morpheus/cli/{cloud_folders_command.rb → commands/cloud_folders_command.rb} +0 -4
  55. data/lib/morpheus/cli/{cloud_resource_pools_command.rb → commands/cloud_resource_pools_command.rb} +170 -138
  56. data/lib/morpheus/cli/{clouds.rb → commands/clouds.rb} +22 -47
  57. data/lib/morpheus/cli/{clusters.rb → commands/clusters.rb} +86 -49
  58. data/lib/morpheus/cli/commands/{standard/coloring_command.rb → coloring_command.rb} +0 -2
  59. data/lib/morpheus/cli/{containers_command.rb → commands/containers_command.rb} +0 -7
  60. data/lib/morpheus/cli/commands/{standard/curl_command.rb → curl_command.rb} +0 -3
  61. data/lib/morpheus/cli/{cypher_command.rb → commands/cypher_command.rb} +0 -1
  62. data/lib/morpheus/cli/{dashboard_command.rb → commands/dashboard_command.rb} +0 -2
  63. data/lib/morpheus/cli/commands/{standard/debug_command.rb → debug_command.rb} +0 -1
  64. data/lib/morpheus/cli/{deploy.rb → commands/deploy.rb} +0 -1
  65. data/lib/morpheus/cli/{deployments.rb → commands/deployments.rb} +0 -0
  66. data/lib/morpheus/cli/{deploys.rb → commands/deploys.rb} +0 -1
  67. data/lib/morpheus/cli/{doc.rb → commands/doc.rb} +1 -1
  68. data/lib/morpheus/cli/commands/{standard/echo_command.rb → echo_command.rb} +0 -2
  69. data/lib/morpheus/cli/commands/{standard/edit_profile_command.rb → edit_profile_command.rb} +15 -4
  70. data/lib/morpheus/cli/commands/{standard/edit_rc_command.rb → edit_rc_command.rb} +19 -3
  71. data/lib/morpheus/cli/{environments_command.rb → commands/environments_command.rb} +0 -5
  72. data/lib/morpheus/cli/{execute_schedules_command.rb → commands/execute_schedules_command.rb} +0 -0
  73. data/lib/morpheus/cli/{execution_request_command.rb → commands/execution_request_command.rb} +0 -2
  74. data/lib/morpheus/cli/commands/{standard/exit_command.rb → exit_command.rb} +0 -2
  75. data/lib/morpheus/cli/{file_copy_request_command.rb → commands/file_copy_request_command.rb} +0 -4
  76. data/lib/morpheus/cli/{forgot_password.rb → commands/forgot_password.rb} +0 -0
  77. data/lib/morpheus/cli/commands/{standard/get_prompt_command.rb → get_prompt_command.rb} +0 -3
  78. data/lib/morpheus/cli/{groups.rb → commands/groups.rb} +0 -7
  79. data/lib/morpheus/cli/{guidance_command.rb → commands/guidance_command.rb} +1 -1
  80. data/lib/morpheus/cli/{health_command.rb → commands/health_command.rb} +104 -19
  81. data/lib/morpheus/cli/commands/{standard/history_command.rb → history_command.rb} +0 -3
  82. data/lib/morpheus/cli/{hosts.rb → commands/hosts.rb} +15 -25
  83. data/lib/morpheus/cli/{image_builder_command.rb → commands/image_builder_command.rb} +2 -8
  84. data/lib/morpheus/cli/{instance_types.rb → commands/instance_types.rb} +0 -3
  85. data/lib/morpheus/cli/{instances.rb → commands/instances.rb} +473 -150
  86. data/lib/morpheus/cli/{integrations_command.rb → commands/integrations_command.rb} +0 -0
  87. data/lib/morpheus/cli/{invoices_command.rb → commands/invoices_command.rb} +118 -134
  88. data/lib/morpheus/cli/{jobs_command.rb → commands/jobs_command.rb} +0 -0
  89. data/lib/morpheus/cli/{key_pairs.rb → commands/key_pairs.rb} +0 -6
  90. data/lib/morpheus/cli/{library_cluster_layouts_command.rb → commands/library_cluster_layouts_command.rb} +20 -4
  91. data/lib/morpheus/cli/{library_container_scripts_command.rb → commands/library_container_scripts_command.rb} +0 -0
  92. data/lib/morpheus/cli/{library_container_templates_command.rb → commands/library_container_templates_command.rb} +0 -1
  93. data/lib/morpheus/cli/{library_container_types_command.rb → commands/library_container_types_command.rb} +0 -4
  94. data/lib/morpheus/cli/{library_instance_types_command.rb → commands/library_instance_types_command.rb} +0 -4
  95. data/lib/morpheus/cli/{library_layouts_command.rb → commands/library_layouts_command.rb} +0 -4
  96. data/lib/morpheus/cli/{library_option_lists_command.rb → commands/library_option_lists_command.rb} +3 -7
  97. data/lib/morpheus/cli/{library_option_types_command.rb → commands/library_option_types_command.rb} +0 -4
  98. data/lib/morpheus/cli/{library_spec_templates_command.rb → commands/library_spec_templates_command.rb} +0 -1
  99. data/lib/morpheus/cli/{library_upgrades_command.rb → commands/library_upgrades_command.rb} +0 -4
  100. data/lib/morpheus/cli/{license.rb → commands/license.rb} +0 -3
  101. data/lib/morpheus/cli/commands/load_balancer_monitors.rb +71 -0
  102. data/lib/morpheus/cli/commands/load_balancer_pools.rb +91 -0
  103. data/lib/morpheus/cli/commands/load_balancer_profiles.rb +65 -0
  104. data/lib/morpheus/cli/{load_balancer_types.rb → commands/load_balancer_types.rb} +9 -8
  105. data/lib/morpheus/cli/commands/load_balancer_virtual_servers.rb +156 -0
  106. data/lib/morpheus/cli/commands/load_balancers.rb +176 -0
  107. data/lib/morpheus/cli/commands/{standard/log_level_command.rb → log_level_command.rb} +0 -3
  108. data/lib/morpheus/cli/{log_settings_command.rb → commands/log_settings_command.rb} +0 -0
  109. data/lib/morpheus/cli/{login.rb → commands/login.rb} +0 -5
  110. data/lib/morpheus/cli/commands/logout.rb +63 -0
  111. data/lib/morpheus/cli/{logs_command.rb → commands/logs_command.rb} +0 -3
  112. data/lib/morpheus/cli/commands/{standard/man_command.rb → man_command.rb} +0 -2
  113. data/lib/morpheus/cli/{monitoring_alerts_command.rb → commands/monitoring_alerts_command.rb} +0 -7
  114. data/lib/morpheus/cli/{monitoring_apps_command.rb → commands/monitoring_apps_command.rb} +0 -1
  115. data/lib/morpheus/cli/{monitoring_checks_command.rb → commands/monitoring_checks_command.rb} +2 -1
  116. data/lib/morpheus/cli/{monitoring_contacts_command.rb → commands/monitoring_contacts_command.rb} +0 -7
  117. data/lib/morpheus/cli/{monitoring_groups_command.rb → commands/monitoring_groups_command.rb} +0 -1
  118. data/lib/morpheus/cli/{monitoring_incidents_command.rb → commands/monitoring_incidents_command.rb} +0 -1
  119. data/lib/morpheus/cli/commands/network_dhcp_relays_command.rb +416 -0
  120. data/lib/morpheus/cli/commands/network_dhcp_servers_command.rb +407 -0
  121. data/lib/morpheus/cli/{network_domains_command.rb → commands/network_domains_command.rb} +0 -4
  122. data/lib/morpheus/cli/commands/network_edge_clusters_command.rb +329 -0
  123. data/lib/morpheus/cli/commands/network_firewalls_command.rb +823 -0
  124. data/lib/morpheus/cli/{network_groups_command.rb → commands/network_groups_command.rb} +0 -4
  125. data/lib/morpheus/cli/{network_pool_servers_command.rb → commands/network_pool_servers_command.rb} +0 -4
  126. data/lib/morpheus/cli/{network_pools_command.rb → commands/network_pools_command.rb} +0 -4
  127. data/lib/morpheus/cli/{network_proxies_command.rb → commands/network_proxies_command.rb} +0 -4
  128. data/lib/morpheus/cli/{network_routers_command.rb → commands/network_routers_command.rb} +387 -57
  129. data/lib/morpheus/cli/{network_services_command.rb → commands/network_services_command.rb} +0 -4
  130. data/lib/morpheus/cli/commands/network_static_routes_command.rb +446 -0
  131. data/lib/morpheus/cli/commands/network_transport_zones_command.rb +452 -0
  132. data/lib/morpheus/cli/{networks_command.rb → commands/networks_command.rb} +21 -21
  133. data/lib/morpheus/cli/commands/open_command.rb +30 -0
  134. data/lib/morpheus/cli/commands/options.rb +98 -0
  135. data/lib/morpheus/cli/{packages_command.rb → commands/packages_command.rb} +0 -2
  136. data/lib/morpheus/cli/{ping.rb → commands/ping.rb} +0 -7
  137. data/lib/morpheus/cli/{policies_command.rb → commands/policies_command.rb} +1 -8
  138. data/lib/morpheus/cli/{power_schedules_command.rb → commands/power_schedules_command.rb} +0 -0
  139. data/lib/morpheus/cli/{preseed_scripts_command.rb → commands/preseed_scripts_command.rb} +0 -3
  140. data/lib/morpheus/cli/{price_sets_command.rb → commands/price_sets_command.rb} +0 -0
  141. data/lib/morpheus/cli/{prices_command.rb → commands/prices_command.rb} +7 -7
  142. data/lib/morpheus/cli/{processes_command.rb → commands/processes_command.rb} +0 -1
  143. data/lib/morpheus/cli/{projects_command.rb → commands/projects_command.rb} +0 -0
  144. data/lib/morpheus/cli/{provisioning_licenses_command.rb → commands/provisioning_licenses_command.rb} +0 -0
  145. data/lib/morpheus/cli/{provisioning_settings_command.rb → commands/provisioning_settings_command.rb} +0 -0
  146. data/lib/morpheus/cli/{recent_activity_command.rb → commands/recent_activity_command.rb} +0 -0
  147. data/lib/morpheus/cli/{remote.rb → commands/remote.rb} +5 -9
  148. data/lib/morpheus/cli/{reports_command.rb → commands/reports_command.rb} +0 -2
  149. data/lib/morpheus/cli/commands/{standard/rm_command.rb → rm_command.rb} +0 -0
  150. data/lib/morpheus/cli/{roles.rb → commands/roles.rb} +245 -40
  151. data/lib/morpheus/cli/{search_command.rb → commands/search_command.rb} +0 -0
  152. data/lib/morpheus/cli/{security_group_rules.rb → commands/security_group_rules.rb} +0 -5
  153. data/lib/morpheus/cli/{security_groups.rb → commands/security_groups.rb} +0 -6
  154. data/lib/morpheus/cli/{service_catalog_command.rb → commands/service_catalog_command.rb} +0 -0
  155. data/lib/morpheus/cli/{service_plans_command.rb → commands/service_plans_command.rb} +0 -0
  156. data/lib/morpheus/cli/commands/{standard/set_prompt_command.rb → set_prompt_command.rb} +0 -3
  157. data/lib/morpheus/cli/{setup.rb → commands/setup.rb} +0 -0
  158. data/lib/morpheus/cli/{shell.rb → commands/shell.rb} +4 -105
  159. data/lib/morpheus/cli/commands/{standard/sleep_command.rb → sleep_command.rb} +0 -2
  160. data/lib/morpheus/cli/commands/{standard/source_command.rb → source_command.rb} +0 -2
  161. data/lib/morpheus/cli/commands/{standard/ssl_verification_command.rb → ssl_verification_command.rb} +0 -3
  162. data/lib/morpheus/cli/{storage_providers_command.rb → commands/storage_providers_command.rb} +0 -4
  163. data/lib/morpheus/cli/commands/storage_server_types.rb +50 -0
  164. data/lib/morpheus/cli/commands/storage_servers.rb +122 -0
  165. data/lib/morpheus/cli/commands/storage_volume_types.rb +50 -0
  166. data/lib/morpheus/cli/commands/storage_volumes.rb +103 -0
  167. data/lib/morpheus/cli/{subnets_command.rb → commands/subnets_command.rb} +7 -6
  168. data/lib/morpheus/cli/{tasks.rb → commands/tasks.rb} +25 -6
  169. data/lib/morpheus/cli/commands/{standard/tee_command.rb → tee_command.rb} +0 -0
  170. data/lib/morpheus/cli/{tenants_command.rb → commands/tenants_command.rb} +1 -8
  171. data/lib/morpheus/cli/commands/{standard/update_command.rb → update_command.rb} +0 -1
  172. data/lib/morpheus/cli/{usage_command.rb → commands/usage_command.rb} +0 -0
  173. data/lib/morpheus/cli/{user_groups_command.rb → commands/user_groups_command.rb} +1 -2
  174. data/lib/morpheus/cli/{user_settings_command.rb → commands/user_settings_command.rb} +2 -1
  175. data/lib/morpheus/cli/{user_sources_command.rb → commands/user_sources_command.rb} +1 -2
  176. data/lib/morpheus/cli/{users.rb → commands/users.rb} +28 -35
  177. data/lib/morpheus/cli/{vdi_allocations_command.rb → commands/vdi_allocations_command.rb} +0 -0
  178. data/lib/morpheus/cli/{vdi_apps_command.rb → commands/vdi_apps_command.rb} +0 -0
  179. data/lib/morpheus/cli/{vdi_command.rb → commands/vdi_command.rb} +0 -0
  180. data/lib/morpheus/cli/{vdi_gateways_command.rb → commands/vdi_gateways_command.rb} +0 -0
  181. data/lib/morpheus/cli/{vdi_pools_command.rb → commands/vdi_pools_command.rb} +4 -1
  182. data/lib/morpheus/cli/commands/{standard/version_command.rb → version_command.rb} +0 -0
  183. data/lib/morpheus/cli/commands/view.rb +102 -0
  184. data/lib/morpheus/cli/{virtual_images.rb → commands/virtual_images.rb} +251 -33
  185. data/lib/morpheus/cli/{whitelabel_settings_command.rb → commands/whitelabel_settings_command.rb} +0 -1
  186. data/lib/morpheus/cli/{whoami.rb → commands/whoami.rb} +0 -4
  187. data/lib/morpheus/cli/{wiki_command.rb → commands/wiki_command.rb} +0 -5
  188. data/lib/morpheus/cli/{workflows.rb → commands/workflows.rb} +0 -3
  189. data/lib/morpheus/cli/mixins/accounts_helper.rb +5 -5
  190. data/lib/morpheus/cli/mixins/load_balancers_helper.rb +26 -6
  191. data/lib/morpheus/cli/mixins/logs_helper.rb +1 -1
  192. data/lib/morpheus/cli/mixins/print_helper.rb +51 -18
  193. data/lib/morpheus/cli/mixins/processes_helper.rb +1 -2
  194. data/lib/morpheus/cli/mixins/provisioning_helper.rb +167 -110
  195. data/lib/morpheus/cli/mixins/rest_command.rb +268 -94
  196. data/lib/morpheus/cli/mixins/secondary_rest_command.rb +668 -0
  197. data/lib/morpheus/cli/mixins/storage_servers_helper.rb +156 -0
  198. data/lib/morpheus/cli/mixins/storage_volumes_helper.rb +119 -0
  199. data/lib/morpheus/cli/option_parser.rb +25 -17
  200. data/lib/morpheus/cli/option_types.rb +137 -52
  201. data/lib/morpheus/cli/version.rb +1 -1
  202. data/lib/morpheus/cli.rb +6 -128
  203. data/lib/morpheus/ext/string.rb +29 -6
  204. data/lib/morpheus/routes.rb +238 -0
  205. data/lib/morpheus/terminal.rb +5 -6
  206. data/lib/morpheus/util.rb +6 -1
  207. data/morpheus-cli.gemspec +1 -1
  208. metadata +183 -149
  209. data/lib/morpheus/cli/change_password_command.rb +0 -147
  210. data/lib/morpheus/cli/library.rb +0 -1
  211. data/lib/morpheus/cli/load_balancers.rb +0 -245
  212. data/lib/morpheus/cli/logout.rb +0 -81
@@ -10,7 +10,8 @@
10
10
  # * load_balancer_column_definitions() - Column definitions for the "get" command display output.
11
11
  # * load_balancer_list_column_definitions() - Column definitions for the "list" command display output.
12
12
  #
13
- # # An example of a RestCommand for `morpheus load-balancers`.
13
+ # Example of a RestCommand for `morpheus load-balancers`.
14
+ #
14
15
  # class Morpheus::Cli::LoadBalancers
15
16
  #
16
17
  # include Morpheus::Cli::CliCommand
@@ -21,7 +22,7 @@
21
22
  # # and would be the default values if not set.
22
23
  # set_rest_name :load_balancers
23
24
  # set_rest_label "Load Balancer"
24
- # set_rest_plural_label "Load Balancers"
25
+ # set_rest_label_plural "Load Balancers"
25
26
  # set_rest_object_key "load_balancer"
26
27
  # set_rest_has_type true
27
28
  # set_rest_type "load_balancer_types"
@@ -38,7 +39,7 @@ module Morpheus::Cli::RestCommand
38
39
 
39
40
  module ClassMethods
40
41
 
41
- # rest_name is the plural name of the rest command resource eg. NeatThingsCommand would be "neat_things"
42
+ # rest_name is the plural name of the resource eg. NeatThings would be "neat_things"
42
43
  # It is used to derive all other default rest settings key, label, etc.
43
44
  # The default name the command name with underscores `_` instead of dashes `-`.
44
45
  def rest_name
@@ -50,7 +51,7 @@ module Morpheus::Cli::RestCommand
50
51
  end
51
52
 
52
53
  def rest_name=(v)
53
- @rest_name = v
54
+ @rest_name = v.to_s
54
55
  end
55
56
 
56
57
  alias :set_rest_name :rest_name=
@@ -61,11 +62,11 @@ module Morpheus::Cli::RestCommand
61
62
  end
62
63
 
63
64
  def default_rest_key
64
- rest_name.chomp("s")
65
+ rest_name.to_s.chomp("s")
65
66
  end
66
67
 
67
68
  def rest_key=(v)
68
- @rest_key = v
69
+ @rest_key = v.to_s
69
70
  end
70
71
 
71
72
  alias :set_rest_key :rest_key=
@@ -80,11 +81,27 @@ module Morpheus::Cli::RestCommand
80
81
  end
81
82
 
82
83
  def rest_arg=(v)
83
- @rest_arg = v
84
+ @rest_arg = v.to_s
84
85
  end
85
86
 
86
87
  alias :set_rest_arg :rest_arg=
87
88
 
89
+ # rest_has_name indicates a resource has a name and can be retrieved by name or id
90
+ # true by default, set to false for lookups by only id
91
+ def rest_has_name
92
+ @rest_has_name != nil ? @rest_has_name : default_rest_has_name
93
+ end
94
+
95
+ def default_rest_has_name
96
+ true
97
+ end
98
+
99
+ def rest_has_name=(v)
100
+ @rest_has_name = !!v
101
+ end
102
+
103
+ alias :set_rest_has_name :rest_has_name=
104
+
88
105
  # rest_label is the capitalized resource label eg. "Neat Thing"
89
106
  def rest_label
90
107
  @rest_label || default_rest_label
@@ -95,26 +112,26 @@ module Morpheus::Cli::RestCommand
95
112
  end
96
113
 
97
114
  def rest_label=(v)
98
- @rest_label = v
115
+ @rest_label = v.to_s
99
116
  end
100
117
 
101
118
  alias :set_rest_label :rest_label=
102
119
 
103
120
  # the plural version of the label eg. "Neat Things"
104
- def rest_plural_label
105
- @rest_plural_label || default_rest_plural_label
121
+ def rest_label_plural
122
+ @rest_label_plural || default_rest_label_plural
106
123
  end
107
124
 
108
- def default_rest_plural_label
125
+ def default_rest_label_plural
109
126
  #rest_name.to_s.split("_").collect {|it| it.to_s.capitalize }.join(" ")
110
127
  rest_label.to_s.pluralize
111
128
  end
112
129
 
113
- def rest_plural_label=(v)
114
- @rest_plural_label = v
130
+ def rest_label_plural=(v)
131
+ @rest_label_plural = v.to_s
115
132
  end
116
133
 
117
- alias :set_rest_plural_label :rest_plural_label=
134
+ alias :set_rest_label_plural :rest_label_plural=
118
135
 
119
136
  # rest_interface_name is the interface name for the resource. eg. "neat_things"
120
137
  def rest_interface_name
@@ -126,7 +143,7 @@ module Morpheus::Cli::RestCommand
126
143
  end
127
144
 
128
145
  def rest_interface_name=(v)
129
- @rest_interface_name = v
146
+ @rest_interface_name = v.to_s
130
147
  end
131
148
 
132
149
  alias :set_rest_interface_name :rest_interface_name=
@@ -158,7 +175,7 @@ module Morpheus::Cli::RestCommand
158
175
  end
159
176
 
160
177
  def rest_type_name=(v)
161
- @rest_type_name = v
178
+ @rest_type_name = v.to_s
162
179
  end
163
180
 
164
181
  alias :set_rest_type_name :rest_type_name=
@@ -175,7 +192,7 @@ module Morpheus::Cli::RestCommand
175
192
  end
176
193
 
177
194
  def rest_type_key=(v)
178
- @rest_type_key = v
195
+ @rest_type_key = v.to_s
179
196
  end
180
197
 
181
198
  alias :set_rest_type_key :rest_type_key=
@@ -190,7 +207,7 @@ module Morpheus::Cli::RestCommand
190
207
  end
191
208
 
192
209
  def rest_type_arg=(v)
193
- @rest_type_arg = v
210
+ @rest_type_arg = v.to_s
194
211
  end
195
212
 
196
213
  alias :set_rest_type_arg :rest_type_arg=
@@ -205,26 +222,26 @@ module Morpheus::Cli::RestCommand
205
222
  end
206
223
 
207
224
  def rest_type_label=(v)
208
- @rest_type_label = v
225
+ @rest_type_label = v.to_s
209
226
  end
210
227
 
211
228
  alias :set_rest_type_label :rest_type_label=
212
229
 
213
230
  # the plural version of the label eg. "Neat Things"
214
- def rest_type_plural_label
215
- @rest_type_plural_label || default_rest_type_plural_label
231
+ def rest_type_label_plural
232
+ @rest_type_label_plural || default_rest_type_label_plural
216
233
  end
217
234
 
218
- def default_rest_type_plural_label
235
+ def default_rest_type_label_plural
219
236
  #rest_type_name.to_s.split("_").collect {|it| it.to_s.capitalize }.join(" ")
220
237
  rest_type_label.to_s.pluralize
221
238
  end
222
239
 
223
- def rest_type_plural_label=(v)
224
- @rest_type_plural_label = v
240
+ def rest_type_label_plural=(v)
241
+ @rest_type_label_plural = v.to_s
225
242
  end
226
243
 
227
- alias :set_rest_type_plural_label :rest_type_plural_label=
244
+ alias :set_rest_type_label_plural :rest_type_label_plural=
228
245
 
229
246
  # the name of the default interface, matches the rest name eg. "neat_things"
230
247
  def rest_type_interface_name
@@ -236,7 +253,7 @@ module Morpheus::Cli::RestCommand
236
253
  end
237
254
 
238
255
  def rest_type_interface_name=(v)
239
- @rest_type_interface_name = v
256
+ @rest_type_interface_name = v.to_s
240
257
  end
241
258
 
242
259
  alias :set_rest_type_interface_name :rest_type_interface_name=
@@ -247,7 +264,7 @@ module Morpheus::Cli::RestCommand
247
264
  def register_interfaces(*interfaces)
248
265
  @registered_interfaces ||= []
249
266
  interfaces.flatten.each do |it|
250
- @registered_interfaces << it.to_sym
267
+ @registered_interfaces << it.to_s
251
268
  end
252
269
  # put the default rest_interface first
253
270
  if rest_interface_name && !@registered_interfaces.include?(rest_interface_name)
@@ -296,12 +313,16 @@ module Morpheus::Cli::RestCommand
296
313
  self.class.rest_arg
297
314
  end
298
315
 
316
+ def rest_has_name
317
+ self.class.rest_has_name
318
+ end
319
+
299
320
  def rest_label
300
321
  self.class.rest_label
301
322
  end
302
323
 
303
- def rest_plural_label
304
- self.class.rest_plural_label
324
+ def rest_label_plural
325
+ self.class.rest_label_plural
305
326
  end
306
327
 
307
328
  def rest_interface_name
@@ -315,23 +336,37 @@ module Morpheus::Cli::RestCommand
315
336
  end
316
337
 
317
338
  def rest_object_key
318
- self.send("#{rest_key}_object_key")
339
+ send("#{rest_key}_object_key")
319
340
  end
320
341
 
321
342
  def rest_list_key
322
- self.send("#{rest_key}_list_key")
343
+ send("#{rest_key}_list_key")
323
344
  end
324
345
 
325
- def rest_column_definitions
326
- self.send("#{rest_key}_column_definitions")
346
+ def rest_column_definitions(options)
347
+ send("#{rest_key}_column_definitions", options)
327
348
  end
328
349
 
329
- def rest_list_column_definitions
330
- self.send("#{rest_key}_list_column_definitions")
350
+ def rest_list_column_definitions(options)
351
+ send("#{rest_key}_list_column_definitions", options)
331
352
  end
332
353
 
333
- def rest_find_by_name_or_id(name)
334
- return self.send("find_#{rest_key}_by_name_or_id", name)
354
+ def rest_find_by_name_or_id(val)
355
+ # use explicitly defined finders
356
+ # else default to new generic CliCommand method to find anything by type (singular underscore)
357
+ if rest_has_name
358
+ if respond_to?("find_#{rest_key}_by_name_or_id", true)
359
+ send("find_#{rest_key}_by_name_or_id", val)
360
+ else
361
+ find_by_name_or_id(rest_key, val)
362
+ end
363
+ else
364
+ if respond_to?("find_#{rest_key}_by_id", true)
365
+ send("find_#{rest_key}_by_id", val)
366
+ else
367
+ find_by_id(rest_key, val)
368
+ end
369
+ end
335
370
  end
336
371
 
337
372
  def rest_has_type
@@ -352,12 +387,16 @@ module Morpheus::Cli::RestCommand
352
387
  self.class.rest_type_arg
353
388
  end
354
389
 
390
+ def rest_has_name
391
+ self.class.rest_type_arg
392
+ end
393
+
355
394
  def rest_type_label
356
395
  self.class.rest_type_label
357
396
  end
358
397
 
359
- def rest_type_plural_label
360
- self.class.rest_type_plural_label
398
+ def rest_type_label_plural
399
+ self.class.rest_type_label_plural
361
400
  end
362
401
 
363
402
  def rest_type_interface_name
@@ -369,23 +408,29 @@ module Morpheus::Cli::RestCommand
369
408
  end
370
409
 
371
410
  def rest_type_object_key
372
- self.send("#{rest_type_key}_object_key")
411
+ send("#{rest_type_key}_object_key")
373
412
  end
374
413
 
375
414
  def rest_type_list_key
376
- self.send("#{rest_type_key}_list_key")
415
+ send("#{rest_type_key}_list_key")
377
416
  end
378
417
 
379
- def rest_type_column_definitions
380
- self.send("#{rest_type_key}_column_definitions")
418
+ def rest_type_column_definitions(options)
419
+ send("#{rest_type_key}_column_definitions", options)
381
420
  end
382
421
 
383
- def rest_type_list_column_definitions
384
- self.send("#{rest_type_key}_list_column_definitions")
422
+ def rest_type_list_column_definitions(options)
423
+ send("#{rest_type_key}_list_column_definitions", options)
385
424
  end
386
425
 
387
- def rest_type_find_by_name_or_id(name)
388
- return self.send("find_#{rest_type_key}_by_name_or_id", name)
426
+ def rest_type_find_by_name_or_id(val)
427
+ # use explicately defined finders
428
+ # else default to new generic CliCommand method to find anything by type (singular underscore)
429
+ if respond_to?("find_#{rest_type_key}_by_name_or_id", true)
430
+ send("find_#{rest_type_key}_by_name_or_id", val)
431
+ else
432
+ find_by_name_or_id(rest_type_key, val)
433
+ end
389
434
  end
390
435
 
391
436
  def registered_interfaces
@@ -415,16 +460,16 @@ module Morpheus::Cli::RestCommand
415
460
  params = {}
416
461
  options = {}
417
462
  optparse = Morpheus::Cli::OptionParser.new do |opts|
418
- opts.banner = subcommand_usage()
419
- build_standard_list_options(opts, options)
420
- opts.footer = "List #{rest_plural_label.downcase}."
463
+ opts.banner = subcommand_usage("[search]")
464
+ build_list_options(opts, options, params)
465
+ opts.footer = <<-EOT
466
+ List #{rest_label_plural.downcase}.
467
+ [search] is optional. This is a search phrase to filter the results.
468
+ EOT
421
469
  end
422
470
  optparse.parse!(args)
423
471
  connect(options)
424
- if args.count > 0
425
- options[:phrase] = args.join(" ")
426
- end
427
- params.merge!(parse_list_options(options))
472
+ parse_list_options!(args, options, params)
428
473
  rest_interface.setopts(options)
429
474
  if options[:dry_run]
430
475
  print_dry_run rest_interface.dry.list(params)
@@ -433,11 +478,11 @@ module Morpheus::Cli::RestCommand
433
478
  json_response = rest_interface.list(params)
434
479
  render_response(json_response, options, rest_list_key) do
435
480
  records = json_response[rest_list_key]
436
- print_h1 "Morpheus #{rest_plural_label}"
481
+ print_h1 "Morpheus #{rest_label_plural}"
437
482
  if records.nil? || records.empty?
438
- print cyan,"No #{rest_plural_label.downcase} found.",reset,"\n"
483
+ print cyan,"No #{rest_label_plural.downcase} found.",reset,"\n"
439
484
  else
440
- print as_pretty_table(records, rest_list_column_definitions.upcase_keys!, options)
485
+ print as_pretty_table(records, rest_list_column_definitions(options).upcase_keys!, options)
441
486
  print_results_pagination(json_response) if json_response['meta']
442
487
  end
443
488
  print reset,"\n"
@@ -449,28 +494,26 @@ module Morpheus::Cli::RestCommand
449
494
  params = {}
450
495
  options = {}
451
496
  optparse = Morpheus::Cli::OptionParser.new do |opts|
452
- opts.banner = subcommand_usage("[type]")
453
- build_standard_get_options(opts, options)
497
+ opts.banner = subcommand_usage("[#{rest_arg}]")
498
+ build_get_options(opts, options, params)
454
499
  opts.footer = <<-EOT
455
500
  Get details about #{a_or_an(rest_label)} #{rest_label.downcase}.
456
- [#{rest_arg}] is required. This is the name or id of #{a_or_an(rest_label)} #{rest_label.downcase}.
501
+ [#{rest_arg}] is required. This is the #{rest_has_name ? 'name or id' : 'id'} of #{a_or_an(rest_label)} #{rest_label.downcase}.
457
502
  EOT
458
503
  end
459
504
  optparse.parse!(args)
460
505
  verify_args!(args:args, optparse:optparse, min:1)
461
506
  connect(options)
462
- params.merge!(parse_query_options(options))
463
- id_list = parse_id_list(args)
464
- return run_command_for_each_arg(id_list) do |arg|
465
- _get(arg, params, options)
466
- end
507
+ parse_get_options!(args, options, params)
508
+ id = args.join(" ")
509
+ _get(id, params, options)
467
510
  end
468
511
 
469
512
  def _get(id, params, options)
470
- if id !~ /\A\d{1,}\Z/
513
+ if id !~ /\A\d{1,}\Z/ && rest_has_name
471
514
  record = rest_find_by_name_or_id(id)
472
515
  if record.nil?
473
- raise_command_error "#{rest_label} not found for name '#{id}'"
516
+ return 1, "#{rest_label} not found for '#{id}'"
474
517
  end
475
518
  id = record['id']
476
519
  end
@@ -489,8 +532,14 @@ EOT
489
532
  record = json_response[rest_object_key]
490
533
  print_h1 rest_label, [], options
491
534
  print cyan
492
- print_description_list(rest_column_definitions, record, options)
493
- # show config settings...
535
+ print_description_list(rest_column_definitions(options), record, options)
536
+ # # could always show config eh? or maybe only with --config if that is nicer.
537
+ # # config = record['config'].is_a?(Hash) && !record['config'].empty?
538
+ # if config && !config.empty?
539
+ # print_h2 "Configuration"
540
+ # print_description_list(config.keys, config)
541
+ # end
542
+ # Option Types
494
543
  if record['optionTypes'] && record['optionTypes'].size > 0
495
544
  print_h2 "Option Types", options
496
545
  print format_option_types_table(record['optionTypes'], options, rest_object_key)
@@ -500,41 +549,51 @@ EOT
500
549
  end
501
550
 
502
551
  def add(args)
552
+ record_type = nil
503
553
  record_type_id = nil
504
554
  options = {}
555
+ option_types = respond_to?("add_#{rest_key}_option_types", true) ? send("add_#{rest_key}_option_types") : []
556
+ advanced_option_types = respond_to?("add_#{rest_key}_advanced_option_types", true) ? send("add_#{rest_key}_advanced_option_types") : []
557
+ type_option_type = option_types.find {|it| it['fieldName'] == 'type'}
505
558
  optparse = Morpheus::Cli::OptionParser.new do |opts|
506
- if rest_has_type
507
- opts.banner = subcommand_usage("[name] -t TYPE")
559
+ opts.banner = subcommand_usage("[#{rest_arg}]")
560
+ if rest_has_type && type_option_type.nil?
508
561
  opts.on( '-t', "--#{rest_type_arg} TYPE", "#{rest_type_label}" ) do |val|
509
562
  record_type_id = val
510
563
  end
511
- else
512
- opts.banner = subcommand_usage("[name]")
513
564
  end
514
- # if defined?(add_#{rest_key}_option_types)
515
- # build_option_type_options(opts, options, add_#{rest_key}_option_types)
516
- # end
565
+ build_option_type_options(opts, options, option_types)
566
+ build_option_type_options(opts, options, advanced_option_types)
517
567
  build_standard_add_options(opts, options)
568
+ opts.footer = <<-EOT
569
+ Create a new #{rest_label.downcase}.
570
+ [#{rest_arg}] is required. This is the name of the new #{rest_label.downcase}.
571
+ EOT
518
572
  end
519
573
  optparse.parse!(args)
520
574
  # todo: make supporting args[0] optional and more flexible
521
575
  # for now args[0] is assumed to be the 'name'
522
576
  record_name = nil
523
- if args[0] # && rest_has_name
524
- record_name = args[0]
525
- end
526
- verify_args!(args:args, optparse:optparse, min:0, max: 1)
527
- # todo: maybe need a flag to make this required, it could be an option type too, so
528
- if rest_has_type
529
- if record_type_id.nil?
530
- raise_command_error "#{rest_type_label} is required.\n#{optparse}"
577
+ if rest_has_name
578
+ if args.count > 0
579
+ record_name = args.join(" ")
531
580
  end
581
+ verify_args!(args:args, optparse:optparse, min:0, max: 1)
582
+ else
583
+ verify_args!(args:args, optparse:optparse, count: 0)
532
584
  end
533
585
  connect(options)
534
- if rest_has_type
586
+ # load or prompt for type
587
+ if rest_has_type && type_option_type.nil?
588
+ if record_type_id.nil?
589
+ #raise_command_error "#{rest_type_label} is required.\n#{optparse}"
590
+ type_list = rest_type_interface.list({max:10000, creatable:true})[rest_type_list_key]
591
+ type_dropdown_options = type_list.collect {|it| {'name' => it['name'], 'value' => it['code']} }
592
+ record_type_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'fieldLabel' => rest_type_label, 'type' => 'select', 'selectOptions' => type_dropdown_options, 'required' => true}], options[:options], @api_client)['type']
593
+ end
535
594
  record_type = rest_type_find_by_name_or_id(record_type_id)
536
595
  if record_type.nil?
537
- raise_command_error "#{rest_type_label} not found for '#{record_type_id}'.\n#{optparse}"
596
+ return 1, "#{rest_type_label} not found for '#{record_type_id}"
538
597
  end
539
598
  end
540
599
  passed_options = parse_passed_options(options)
@@ -549,13 +608,40 @@ EOT
549
608
  options[:options]['name'] = record_name # injected for prompt
550
609
  end
551
610
  if rest_has_type && record_type
552
- # record_payload['type'] = {'code' => record_type['code']}
611
+ # inject type to options for prompting
553
612
  record_payload['type'] = record_type['code']
554
- options[:options]['type'] = record_type['code'] # injected for prompt
613
+ options[:options]['type'] = record_type['code']
614
+ # initialize params for loading optionSource data
615
+ options[:params] ||= {}
616
+ options[:params]['type'] = record_type['code']
555
617
  end
556
618
  record_payload.deep_merge!(passed_options)
619
+ if option_types && !option_types.empty?
620
+ v_prompt = Morpheus::Cli::OptionTypes.prompt(option_types, options[:options], @api_client, options[:params])
621
+ v_prompt.deep_compact!
622
+ v_prompt.booleanize! # 'on' => true
623
+ record_payload.deep_merge!(v_prompt)
624
+ end
557
625
  # options by type
558
- my_option_types = record_type ? record_type['optionTypes'] : nil
626
+ if rest_has_type && record_type.nil?
627
+ type_value = record_payload['type'].is_a?(Hash) ? record_payload['type']['id'] : record_payload['type']
628
+ if type_value
629
+ record_type = rest_type_find_by_name_or_id(type_value)
630
+ if record_type.nil?
631
+ return 1, "#{rest_type_label} not found for '#{type_value}"
632
+ end
633
+ end
634
+ # reload the type by id to get all the details ie. optionTypes
635
+ if record_type && record_type['optionTypes'].nil?
636
+ record_type = rest_type_find_by_name_or_id(record_type['id'])
637
+ end
638
+ end
639
+ my_option_types = nil
640
+ if respond_to?("load_option_types_for_#{rest_key}", true)
641
+ my_option_types = send("load_option_types_for_#{rest_key}", record_type, nil)
642
+ else
643
+ my_option_types = record_type ? record_type['optionTypes'] : nil
644
+ end
559
645
  if my_option_types && !my_option_types.empty?
560
646
  # remove redundant fieldContext
561
647
  my_option_types.each do |option_type|
@@ -563,7 +649,15 @@ EOT
563
649
  option_type['fieldContext'] = nil
564
650
  end
565
651
  end
566
- v_prompt = Morpheus::Cli::OptionTypes.prompt(my_option_types, options[:options], @api_client, options[:params])
652
+ api_params = (options[:params] || {}).merge(record_payload)
653
+ v_prompt = Morpheus::Cli::OptionTypes.prompt(my_option_types, options[:options], @api_client, api_params)
654
+ v_prompt.deep_compact!
655
+ v_prompt.booleanize! # 'on' => true
656
+ record_payload.deep_merge!(v_prompt)
657
+ end
658
+ # advanced options (uses no_prompt)
659
+ if advanced_option_types && !advanced_option_types.empty?
660
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(advanced_option_types, options[:options], @api_client, options[:params])
567
661
  v_prompt.deep_compact!
568
662
  v_prompt.booleanize! # 'on' => true
569
663
  record_payload.deep_merge!(v_prompt)
@@ -586,24 +680,100 @@ EOT
586
680
 
587
681
  def update(args)
588
682
  id = args[0]
683
+ record_type = nil
684
+ record_type_id = nil
589
685
  options = {}
590
- params = {}
591
- account_name = nil
686
+ option_types = respond_to?("update_#{rest_key}_option_types", true) ? send("update_#{rest_key}_option_types") : []
687
+ advanced_option_types = respond_to?("update_#{rest_key}_advanced_option_types", true) ? send("update_#{rest_key}_advanced_option_types") : []
592
688
  optparse = Morpheus::Cli::OptionParser.new do |opts|
593
689
  opts.banner = subcommand_usage("[#{rest_arg}] [options]")
690
+ build_option_type_options(opts, options, option_types)
691
+ build_option_type_options(opts, options, advanced_option_types)
594
692
  build_standard_update_options(opts, options)
693
+ opts.footer = <<-EOT
694
+ Update an existing #{rest_label.downcase}.
695
+ [#{rest_arg}] is required. This is the #{rest_has_name ? 'name or id' : 'id'} of #{a_or_an(rest_label)} #{rest_label.downcase}.
696
+ EOT
595
697
  end
596
698
  optparse.parse!(args)
597
699
  verify_args!(args:args, optparse:optparse, count:1)
598
700
  connect(options)
599
701
  record = rest_find_by_name_or_id(id)
702
+ if record.nil?
703
+ return 1, "#{rest_name} not found for '#{id}'"
704
+ end
705
+ # load type so we can prompt for those option types
706
+ if rest_has_type
707
+ record_type_id = record['type']['id']
708
+ record_type = rest_type_find_by_name_or_id(record_type_id)
709
+ if record_type.nil?
710
+ return 1, "#{rest_type_label} not found for '#{record_type_id}"
711
+ end
712
+ # reload the type by id to get all the details ie. optionTypes
713
+ if record_type['optionTypes'].nil?
714
+ record_type = rest_type_find_by_name_or_id(record_type['id'])
715
+ end
716
+ end
600
717
  passed_options = parse_passed_options(options)
601
- payload = nil
718
+ payload = {}
602
719
  if options[:payload]
603
720
  payload = options[:payload]
604
721
  payload.deep_merge!({rest_object_key => passed_options}) unless passed_options.empty?
605
722
  else
606
723
  record_payload = passed_options
724
+ if rest_has_type && record_type
725
+ # inject type to options for prompting
726
+ # record_payload['type'] = record_type['code']
727
+ # options[:options]['type'] = record_type['code']
728
+ # initialize params for loading optionSource data
729
+ options[:params] ||= {}
730
+ options[:params]['type'] = record_type['code']
731
+ end
732
+ # update options without prompting by default
733
+ if option_types && !option_types.empty?
734
+ api_params = (options[:params] || {}).merge(record_payload) # need to merge in values from record too, ughhh
735
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(option_types, options[:options], @api_client, api_params)
736
+ v_prompt.deep_compact!
737
+ v_prompt.booleanize! # 'on' => true
738
+ record_payload.deep_merge!(v_prompt)
739
+ end
740
+ # options by type
741
+ my_option_types = nil
742
+ if respond_to?("load_option_types_for_#{rest_key}", true)
743
+ my_option_types = send("load_option_types_for_#{rest_key}", record_type, nil)
744
+ else
745
+ my_option_types = record_type ? record_type['optionTypes'] : nil
746
+ end
747
+ if my_option_types && !my_option_types.empty?
748
+ # remove redundant fieldContext
749
+ # make them optional for updates
750
+ # todo: use current value as default instead of just making things optioanl
751
+ # maybe new prompt() options like {:mode => :edit, :object => storage_server} or something
752
+ my_option_types.each do |option_type|
753
+ if option_type['fieldContext'] == rest_object_key
754
+ option_type['fieldContext'] = nil
755
+ end
756
+ option_type.delete('required')
757
+ option_type.delete('defaultValue')
758
+ end
759
+ api_params = (options[:params] || {}).merge(record_payload) # need to merge in values from record too, ughhh
760
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(my_option_types, options[:options], @api_client, api_params)
761
+ v_prompt.deep_compact!
762
+ v_prompt.booleanize! # 'on' => true
763
+ record_payload.deep_merge!(v_prompt)
764
+ end
765
+ # advanced options
766
+ if advanced_option_types && !advanced_option_types.empty?
767
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(advanced_option_types, options[:options], @api_client, options[:params])
768
+ v_prompt.deep_compact!
769
+ v_prompt.booleanize! # 'on' => true
770
+ record_payload.deep_merge!(v_prompt)
771
+ end
772
+ # remove empty config, compact could hanlde this
773
+ if record_payload['config'] && record_payload['config'].empty?
774
+ record_payload.delete('config')
775
+ end
776
+ # prevent updating with empty payload
607
777
  if record_payload.empty?
608
778
  raise_command_error "Specify at least one option to update.\n#{optparse}"
609
779
  end
@@ -629,6 +799,10 @@ EOT
629
799
  optparse = Morpheus::Cli::OptionParser.new do |opts|
630
800
  opts.banner = subcommand_usage("[#{rest_arg}]")
631
801
  build_standard_remove_options(opts, options)
802
+ opts.footer = <<-EOT
803
+ Delete an existing #{rest_label.downcase}.
804
+ [#{rest_arg}] is required. This is the #{rest_has_name ? 'name or id' : 'id'} of #{a_or_an(rest_label)} #{rest_label.downcase}.
805
+ EOT
632
806
  end
633
807
  optparse.parse!(args)
634
808
  verify_args!(args:args, optparse:optparse, count:1)
@@ -643,7 +817,7 @@ EOT
643
817
  end
644
818
  rest_interface.setopts(options)
645
819
  if options[:dry_run]
646
- print_dry_run rest_interface.dry.destroy(record['id'])
820
+ print_dry_run rest_interface.dry.destroy(record['id'], params)
647
821
  return 0, nil
648
822
  end
649
823
  json_response = rest_interface.destroy(record['id'], params)