morpheus-cli 5.3.3 → 5.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) 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 +21 -0
  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_servers_interface.rb +9 -0
  30. data/lib/morpheus/cli/cli_command.rb +262 -14
  31. data/lib/morpheus/cli/cli_registry.rb +2 -1
  32. data/lib/morpheus/cli/{access_token_command.rb → commands/access_token_command.rb} +1 -1
  33. data/lib/morpheus/cli/{account_groups_command.rb → commands/account_groups_command.rb} +0 -8
  34. data/lib/morpheus/cli/{activity_command.rb → commands/activity_command.rb} +0 -0
  35. data/lib/morpheus/cli/commands/{standard/alias_command.rb → alias_command.rb} +1 -4
  36. data/lib/morpheus/cli/{appliance_settings_command.rb → commands/appliance_settings_command.rb} +0 -0
  37. data/lib/morpheus/cli/{approvals_command.rb → commands/approvals_command.rb} +0 -0
  38. data/lib/morpheus/cli/{apps.rb → commands/apps.rb} +14 -87
  39. data/lib/morpheus/cli/{archives_command.rb → commands/archives_command.rb} +0 -6
  40. data/lib/morpheus/cli/commands/audit.rb +188 -0
  41. data/lib/morpheus/cli/{backup_jobs_command.rb → commands/backup_jobs_command.rb} +0 -0
  42. data/lib/morpheus/cli/{backup_settings_command.rb → commands/backup_settings_command.rb} +0 -0
  43. data/lib/morpheus/cli/{backups_command.rb → commands/backups_command.rb} +0 -0
  44. data/lib/morpheus/cli/commands/{standard/benchmark_command.rb → benchmark_command.rb} +0 -3
  45. data/lib/morpheus/cli/{blueprints_command.rb → commands/blueprints_command.rb} +1 -1
  46. data/lib/morpheus/cli/{boot_scripts_command.rb → commands/boot_scripts_command.rb} +0 -3
  47. data/lib/morpheus/cli/{budgets_command.rb → commands/budgets_command.rb} +0 -0
  48. data/lib/morpheus/cli/commands/{standard/cat_command.rb → cat_command.rb} +0 -0
  49. data/lib/morpheus/cli/{catalog_item_types_command.rb → commands/catalog_item_types_command.rb} +0 -0
  50. data/lib/morpheus/cli/{certificates_command.rb → commands/certificates_command.rb} +0 -0
  51. data/lib/morpheus/cli/commands/change_password_command.rb +132 -0
  52. data/lib/morpheus/cli/{cloud_datastores_command.rb → commands/cloud_datastores_command.rb} +0 -4
  53. data/lib/morpheus/cli/{cloud_folders_command.rb → commands/cloud_folders_command.rb} +0 -4
  54. data/lib/morpheus/cli/{cloud_resource_pools_command.rb → commands/cloud_resource_pools_command.rb} +1 -5
  55. data/lib/morpheus/cli/{clouds.rb → commands/clouds.rb} +22 -47
  56. data/lib/morpheus/cli/{clusters.rb → commands/clusters.rb} +38 -19
  57. data/lib/morpheus/cli/commands/{standard/coloring_command.rb → coloring_command.rb} +0 -2
  58. data/lib/morpheus/cli/{containers_command.rb → commands/containers_command.rb} +0 -7
  59. data/lib/morpheus/cli/commands/{standard/curl_command.rb → curl_command.rb} +0 -3
  60. data/lib/morpheus/cli/{cypher_command.rb → commands/cypher_command.rb} +0 -1
  61. data/lib/morpheus/cli/{dashboard_command.rb → commands/dashboard_command.rb} +0 -2
  62. data/lib/morpheus/cli/commands/{standard/debug_command.rb → debug_command.rb} +0 -1
  63. data/lib/morpheus/cli/{deploy.rb → commands/deploy.rb} +0 -1
  64. data/lib/morpheus/cli/{deployments.rb → commands/deployments.rb} +0 -0
  65. data/lib/morpheus/cli/{deploys.rb → commands/deploys.rb} +0 -1
  66. data/lib/morpheus/cli/{doc.rb → commands/doc.rb} +1 -1
  67. data/lib/morpheus/cli/commands/{standard/echo_command.rb → echo_command.rb} +0 -2
  68. data/lib/morpheus/cli/commands/{standard/edit_profile_command.rb → edit_profile_command.rb} +15 -4
  69. data/lib/morpheus/cli/commands/{standard/edit_rc_command.rb → edit_rc_command.rb} +19 -3
  70. data/lib/morpheus/cli/{environments_command.rb → commands/environments_command.rb} +0 -5
  71. data/lib/morpheus/cli/{execute_schedules_command.rb → commands/execute_schedules_command.rb} +0 -0
  72. data/lib/morpheus/cli/{execution_request_command.rb → commands/execution_request_command.rb} +0 -2
  73. data/lib/morpheus/cli/commands/{standard/exit_command.rb → exit_command.rb} +0 -2
  74. data/lib/morpheus/cli/{file_copy_request_command.rb → commands/file_copy_request_command.rb} +0 -4
  75. data/lib/morpheus/cli/{forgot_password.rb → commands/forgot_password.rb} +0 -0
  76. data/lib/morpheus/cli/commands/{standard/get_prompt_command.rb → get_prompt_command.rb} +0 -3
  77. data/lib/morpheus/cli/{groups.rb → commands/groups.rb} +0 -7
  78. data/lib/morpheus/cli/{guidance_command.rb → commands/guidance_command.rb} +1 -1
  79. data/lib/morpheus/cli/{health_command.rb → commands/health_command.rb} +104 -19
  80. data/lib/morpheus/cli/commands/{standard/history_command.rb → history_command.rb} +0 -3
  81. data/lib/morpheus/cli/{hosts.rb → commands/hosts.rb} +15 -25
  82. data/lib/morpheus/cli/{image_builder_command.rb → commands/image_builder_command.rb} +6 -16
  83. data/lib/morpheus/cli/{instance_types.rb → commands/instance_types.rb} +0 -3
  84. data/lib/morpheus/cli/{instances.rb → commands/instances.rb} +220 -13
  85. data/lib/morpheus/cli/{integrations_command.rb → commands/integrations_command.rb} +1 -12
  86. data/lib/morpheus/cli/{invoices_command.rb → commands/invoices_command.rb} +43 -39
  87. data/lib/morpheus/cli/{jobs_command.rb → commands/jobs_command.rb} +0 -0
  88. data/lib/morpheus/cli/{key_pairs.rb → commands/key_pairs.rb} +0 -6
  89. data/lib/morpheus/cli/{library_cluster_layouts_command.rb → commands/library_cluster_layouts_command.rb} +0 -4
  90. data/lib/morpheus/cli/{library_container_scripts_command.rb → commands/library_container_scripts_command.rb} +0 -0
  91. data/lib/morpheus/cli/{library_container_templates_command.rb → commands/library_container_templates_command.rb} +0 -1
  92. data/lib/morpheus/cli/{library_container_types_command.rb → commands/library_container_types_command.rb} +0 -4
  93. data/lib/morpheus/cli/{library_instance_types_command.rb → commands/library_instance_types_command.rb} +0 -4
  94. data/lib/morpheus/cli/{library_layouts_command.rb → commands/library_layouts_command.rb} +0 -4
  95. data/lib/morpheus/cli/{library_option_lists_command.rb → commands/library_option_lists_command.rb} +3 -7
  96. data/lib/morpheus/cli/{library_option_types_command.rb → commands/library_option_types_command.rb} +0 -4
  97. data/lib/morpheus/cli/{library_spec_templates_command.rb → commands/library_spec_templates_command.rb} +0 -1
  98. data/lib/morpheus/cli/{library_upgrades_command.rb → commands/library_upgrades_command.rb} +0 -4
  99. data/lib/morpheus/cli/{license.rb → commands/license.rb} +0 -3
  100. data/lib/morpheus/cli/commands/load_balancer_monitors.rb +70 -0
  101. data/lib/morpheus/cli/commands/load_balancer_pools.rb +90 -0
  102. data/lib/morpheus/cli/commands/load_balancer_profiles.rb +64 -0
  103. data/lib/morpheus/cli/{load_balancer_types.rb → commands/load_balancer_types.rb} +9 -8
  104. data/lib/morpheus/cli/commands/load_balancer_virtual_servers.rb +147 -0
  105. data/lib/morpheus/cli/commands/load_balancers.rb +192 -0
  106. data/lib/morpheus/cli/commands/{standard/log_level_command.rb → log_level_command.rb} +0 -3
  107. data/lib/morpheus/cli/{log_settings_command.rb → commands/log_settings_command.rb} +0 -0
  108. data/lib/morpheus/cli/{login.rb → commands/login.rb} +0 -5
  109. data/lib/morpheus/cli/commands/logout.rb +63 -0
  110. data/lib/morpheus/cli/{logs_command.rb → commands/logs_command.rb} +0 -3
  111. data/lib/morpheus/cli/commands/{standard/man_command.rb → man_command.rb} +0 -2
  112. data/lib/morpheus/cli/{monitoring_alerts_command.rb → commands/monitoring_alerts_command.rb} +0 -7
  113. data/lib/morpheus/cli/{monitoring_apps_command.rb → commands/monitoring_apps_command.rb} +0 -1
  114. data/lib/morpheus/cli/{monitoring_checks_command.rb → commands/monitoring_checks_command.rb} +0 -1
  115. data/lib/morpheus/cli/{monitoring_contacts_command.rb → commands/monitoring_contacts_command.rb} +0 -7
  116. data/lib/morpheus/cli/{monitoring_groups_command.rb → commands/monitoring_groups_command.rb} +0 -1
  117. data/lib/morpheus/cli/{monitoring_incidents_command.rb → commands/monitoring_incidents_command.rb} +0 -1
  118. data/lib/morpheus/cli/commands/network_dhcp_relays_command.rb +416 -0
  119. data/lib/morpheus/cli/commands/network_dhcp_servers_command.rb +407 -0
  120. data/lib/morpheus/cli/{network_domains_command.rb → commands/network_domains_command.rb} +0 -4
  121. data/lib/morpheus/cli/commands/network_edge_clusters_command.rb +329 -0
  122. data/lib/morpheus/cli/commands/network_firewalls_command.rb +823 -0
  123. data/lib/morpheus/cli/{network_groups_command.rb → commands/network_groups_command.rb} +0 -4
  124. data/lib/morpheus/cli/{network_pool_servers_command.rb → commands/network_pool_servers_command.rb} +0 -4
  125. data/lib/morpheus/cli/{network_pools_command.rb → commands/network_pools_command.rb} +0 -4
  126. data/lib/morpheus/cli/{network_proxies_command.rb → commands/network_proxies_command.rb} +0 -4
  127. data/lib/morpheus/cli/{network_routers_command.rb → commands/network_routers_command.rb} +387 -57
  128. data/lib/morpheus/cli/{network_services_command.rb → commands/network_services_command.rb} +0 -4
  129. data/lib/morpheus/cli/commands/network_static_routes_command.rb +446 -0
  130. data/lib/morpheus/cli/commands/network_transport_zones_command.rb +452 -0
  131. data/lib/morpheus/cli/{networks_command.rb → commands/networks_command.rb} +20 -20
  132. data/lib/morpheus/cli/commands/open_command.rb +30 -0
  133. data/lib/morpheus/cli/commands/options.rb +98 -0
  134. data/lib/morpheus/cli/{packages_command.rb → commands/packages_command.rb} +0 -2
  135. data/lib/morpheus/cli/{ping.rb → commands/ping.rb} +0 -7
  136. data/lib/morpheus/cli/{policies_command.rb → commands/policies_command.rb} +1 -8
  137. data/lib/morpheus/cli/{power_schedules_command.rb → commands/power_schedules_command.rb} +0 -0
  138. data/lib/morpheus/cli/{preseed_scripts_command.rb → commands/preseed_scripts_command.rb} +0 -3
  139. data/lib/morpheus/cli/{price_sets_command.rb → commands/price_sets_command.rb} +0 -0
  140. data/lib/morpheus/cli/{prices_command.rb → commands/prices_command.rb} +7 -7
  141. data/lib/morpheus/cli/{processes_command.rb → commands/processes_command.rb} +0 -1
  142. data/lib/morpheus/cli/{projects_command.rb → commands/projects_command.rb} +0 -0
  143. data/lib/morpheus/cli/{provisioning_licenses_command.rb → commands/provisioning_licenses_command.rb} +0 -0
  144. data/lib/morpheus/cli/{provisioning_settings_command.rb → commands/provisioning_settings_command.rb} +0 -0
  145. data/lib/morpheus/cli/{recent_activity_command.rb → commands/recent_activity_command.rb} +0 -0
  146. data/lib/morpheus/cli/{remote.rb → commands/remote.rb} +5 -9
  147. data/lib/morpheus/cli/{reports_command.rb → commands/reports_command.rb} +0 -2
  148. data/lib/morpheus/cli/commands/{standard/rm_command.rb → rm_command.rb} +0 -0
  149. data/lib/morpheus/cli/{roles.rb → commands/roles.rb} +245 -40
  150. data/lib/morpheus/cli/{search_command.rb → commands/search_command.rb} +0 -0
  151. data/lib/morpheus/cli/{security_group_rules.rb → commands/security_group_rules.rb} +0 -5
  152. data/lib/morpheus/cli/{security_groups.rb → commands/security_groups.rb} +0 -6
  153. data/lib/morpheus/cli/{service_catalog_command.rb → commands/service_catalog_command.rb} +0 -0
  154. data/lib/morpheus/cli/{service_plans_command.rb → commands/service_plans_command.rb} +0 -0
  155. data/lib/morpheus/cli/commands/{standard/set_prompt_command.rb → set_prompt_command.rb} +0 -3
  156. data/lib/morpheus/cli/{setup.rb → commands/setup.rb} +0 -0
  157. data/lib/morpheus/cli/{shell.rb → commands/shell.rb} +4 -105
  158. data/lib/morpheus/cli/commands/{standard/sleep_command.rb → sleep_command.rb} +0 -2
  159. data/lib/morpheus/cli/commands/{standard/source_command.rb → source_command.rb} +0 -2
  160. data/lib/morpheus/cli/commands/{standard/ssl_verification_command.rb → ssl_verification_command.rb} +0 -3
  161. data/lib/morpheus/cli/{storage_providers_command.rb → commands/storage_providers_command.rb} +0 -4
  162. data/lib/morpheus/cli/commands/storage_server_types.rb +50 -0
  163. data/lib/morpheus/cli/commands/storage_servers.rb +122 -0
  164. data/lib/morpheus/cli/commands/storage_volume_types.rb +50 -0
  165. data/lib/morpheus/cli/commands/storage_volumes.rb +103 -0
  166. data/lib/morpheus/cli/{subnets_command.rb → commands/subnets_command.rb} +7 -6
  167. data/lib/morpheus/cli/{tasks.rb → commands/tasks.rb} +25 -6
  168. data/lib/morpheus/cli/commands/{standard/tee_command.rb → tee_command.rb} +0 -0
  169. data/lib/morpheus/cli/{tenants_command.rb → commands/tenants_command.rb} +1 -8
  170. data/lib/morpheus/cli/commands/{standard/update_command.rb → update_command.rb} +0 -1
  171. data/lib/morpheus/cli/{usage_command.rb → commands/usage_command.rb} +0 -0
  172. data/lib/morpheus/cli/{user_groups_command.rb → commands/user_groups_command.rb} +1 -2
  173. data/lib/morpheus/cli/{user_settings_command.rb → commands/user_settings_command.rb} +2 -1
  174. data/lib/morpheus/cli/{user_sources_command.rb → commands/user_sources_command.rb} +1 -2
  175. data/lib/morpheus/cli/{users.rb → commands/users.rb} +28 -35
  176. data/lib/morpheus/cli/{vdi_allocations_command.rb → commands/vdi_allocations_command.rb} +0 -0
  177. data/lib/morpheus/cli/{vdi_apps_command.rb → commands/vdi_apps_command.rb} +0 -0
  178. data/lib/morpheus/cli/{vdi_command.rb → commands/vdi_command.rb} +0 -0
  179. data/lib/morpheus/cli/{vdi_gateways_command.rb → commands/vdi_gateways_command.rb} +0 -0
  180. data/lib/morpheus/cli/{vdi_pools_command.rb → commands/vdi_pools_command.rb} +0 -0
  181. data/lib/morpheus/cli/commands/{standard/version_command.rb → version_command.rb} +0 -0
  182. data/lib/morpheus/cli/commands/view.rb +102 -0
  183. data/lib/morpheus/cli/{virtual_images.rb → commands/virtual_images.rb} +2 -4
  184. data/lib/morpheus/cli/{whitelabel_settings_command.rb → commands/whitelabel_settings_command.rb} +0 -1
  185. data/lib/morpheus/cli/{whoami.rb → commands/whoami.rb} +0 -4
  186. data/lib/morpheus/cli/{wiki_command.rb → commands/wiki_command.rb} +0 -5
  187. data/lib/morpheus/cli/{workflows.rb → commands/workflows.rb} +0 -3
  188. data/lib/morpheus/cli/mixins/accounts_helper.rb +5 -5
  189. data/lib/morpheus/cli/mixins/load_balancers_helper.rb +26 -6
  190. data/lib/morpheus/cli/mixins/logs_helper.rb +1 -1
  191. data/lib/morpheus/cli/mixins/print_helper.rb +51 -18
  192. data/lib/morpheus/cli/mixins/processes_helper.rb +1 -2
  193. data/lib/morpheus/cli/mixins/provisioning_helper.rb +48 -17
  194. data/lib/morpheus/cli/mixins/rest_command.rb +270 -94
  195. data/lib/morpheus/cli/mixins/secondary_rest_command.rb +667 -0
  196. data/lib/morpheus/cli/mixins/storage_servers_helper.rb +156 -0
  197. data/lib/morpheus/cli/mixins/storage_volumes_helper.rb +119 -0
  198. data/lib/morpheus/cli/option_types.rb +149 -40
  199. data/lib/morpheus/cli/version.rb +1 -1
  200. data/lib/morpheus/cli.rb +6 -128
  201. data/lib/morpheus/ext/string.rb +29 -6
  202. data/lib/morpheus/routes.rb +238 -0
  203. data/lib/morpheus/terminal.rb +5 -6
  204. data/lib/morpheus/util.rb +6 -1
  205. metadata +176 -141
  206. data/lib/morpheus/cli/change_password_command.rb +0 -147
  207. data/lib/morpheus/cli/library.rb +0 -1
  208. data/lib/morpheus/cli/load_balancers.rb +0 -245
  209. 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,52 @@ 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
572
+ opts.footer += send "add_#{rest_key}_footer_addn" if respond_to?("add_#{rest_key}_footer_addn", true)
518
573
  end
519
574
  optparse.parse!(args)
520
575
  # todo: make supporting args[0] optional and more flexible
521
576
  # for now args[0] is assumed to be the 'name'
522
577
  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}"
578
+ if rest_has_name
579
+ if args.count > 0
580
+ record_name = args.join(" ")
531
581
  end
582
+ verify_args!(args:args, optparse:optparse, min:0, max: 1)
583
+ else
584
+ verify_args!(args:args, optparse:optparse, count: 0)
532
585
  end
533
586
  connect(options)
534
- if rest_has_type
587
+ # load or prompt for type
588
+ if rest_has_type && type_option_type.nil?
589
+ if record_type_id.nil?
590
+ #raise_command_error "#{rest_type_label} is required.\n#{optparse}"
591
+ type_list = rest_type_interface.list({max:10000, creatable:true})[rest_type_list_key]
592
+ type_dropdown_options = respond_to?("#{rest_key}_type_list_to_options", true) ? send("#{rest_key}_type_list_to_options", type_list) : type_list.collect {|it| {'name' => it['name'], 'value' => it['code']} }
593
+ 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']
594
+ end
535
595
  record_type = rest_type_find_by_name_or_id(record_type_id)
536
596
  if record_type.nil?
537
- raise_command_error "#{rest_type_label} not found for '#{record_type_id}'.\n#{optparse}"
597
+ return 1, "#{rest_type_label} not found for '#{record_type_id}"
538
598
  end
539
599
  end
540
600
  passed_options = parse_passed_options(options)
@@ -549,13 +609,40 @@ EOT
549
609
  options[:options]['name'] = record_name # injected for prompt
550
610
  end
551
611
  if rest_has_type && record_type
552
- # record_payload['type'] = {'code' => record_type['code']}
612
+ # inject type to options for prompting
553
613
  record_payload['type'] = record_type['code']
554
- options[:options]['type'] = record_type['code'] # injected for prompt
614
+ options[:options]['type'] = record_type['code']
615
+ # initialize params for loading optionSource data
616
+ options[:params] ||= {}
617
+ options[:params]['type'] = record_type['code']
555
618
  end
556
619
  record_payload.deep_merge!(passed_options)
620
+ if option_types && !option_types.empty?
621
+ v_prompt = Morpheus::Cli::OptionTypes.prompt(option_types, options[:options], @api_client, options[:params])
622
+ v_prompt.deep_compact!
623
+ v_prompt.booleanize! # 'on' => true
624
+ record_payload.deep_merge!(v_prompt)
625
+ end
557
626
  # options by type
558
- my_option_types = record_type ? record_type['optionTypes'] : nil
627
+ if rest_has_type && record_type.nil?
628
+ type_value = record_payload['type'].is_a?(Hash) ? record_payload['type']['id'] : record_payload['type']
629
+ if type_value
630
+ record_type = rest_type_find_by_name_or_id(type_value)
631
+ if record_type.nil?
632
+ return 1, "#{rest_type_label} not found for '#{type_value}"
633
+ end
634
+ end
635
+ # reload the type by id to get all the details ie. optionTypes
636
+ if record_type && record_type['optionTypes'].nil?
637
+ record_type = rest_type_find_by_name_or_id(record_type['id'])
638
+ end
639
+ end
640
+ my_option_types = nil
641
+ if respond_to?("load_option_types_for_#{rest_key}", true)
642
+ my_option_types = send("load_option_types_for_#{rest_key}", record_type, nil)
643
+ else
644
+ my_option_types = record_type ? record_type['optionTypes'] : nil
645
+ end
559
646
  if my_option_types && !my_option_types.empty?
560
647
  # remove redundant fieldContext
561
648
  my_option_types.each do |option_type|
@@ -563,7 +650,15 @@ EOT
563
650
  option_type['fieldContext'] = nil
564
651
  end
565
652
  end
566
- v_prompt = Morpheus::Cli::OptionTypes.prompt(my_option_types, options[:options], @api_client, options[:params])
653
+ api_params = (options[:params] || {}).merge(record_payload)
654
+ v_prompt = Morpheus::Cli::OptionTypes.prompt(my_option_types, options[:options], @api_client, api_params)
655
+ v_prompt.deep_compact!
656
+ v_prompt.booleanize! # 'on' => true
657
+ record_payload.deep_merge!(v_prompt)
658
+ end
659
+ # advanced options (uses no_prompt)
660
+ if advanced_option_types && !advanced_option_types.empty?
661
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(advanced_option_types, options[:options], @api_client, options[:params])
567
662
  v_prompt.deep_compact!
568
663
  v_prompt.booleanize! # 'on' => true
569
664
  record_payload.deep_merge!(v_prompt)
@@ -586,24 +681,101 @@ EOT
586
681
 
587
682
  def update(args)
588
683
  id = args[0]
684
+ record_type = nil
685
+ record_type_id = nil
589
686
  options = {}
590
- params = {}
591
- account_name = nil
687
+ option_types = respond_to?("update_#{rest_key}_option_types", true) ? send("update_#{rest_key}_option_types") : []
688
+ advanced_option_types = respond_to?("update_#{rest_key}_advanced_option_types", true) ? send("update_#{rest_key}_advanced_option_types") : []
592
689
  optparse = Morpheus::Cli::OptionParser.new do |opts|
593
690
  opts.banner = subcommand_usage("[#{rest_arg}] [options]")
691
+ build_option_type_options(opts, options, option_types)
692
+ build_option_type_options(opts, options, advanced_option_types)
594
693
  build_standard_update_options(opts, options)
694
+ opts.footer = <<-EOT
695
+ Update an existing #{rest_label.downcase}.
696
+ [#{rest_arg}] is required. This is the #{rest_has_name ? 'name or id' : 'id'} of #{a_or_an(rest_label)} #{rest_label.downcase}.
697
+ EOT
698
+ opts.footer += send "update_#{rest_key}_footer_addn" if respond_to?("update_#{rest_key}_footer_addn", true)
595
699
  end
596
700
  optparse.parse!(args)
597
701
  verify_args!(args:args, optparse:optparse, count:1)
598
702
  connect(options)
599
703
  record = rest_find_by_name_or_id(id)
704
+ if record.nil?
705
+ return 1, "#{rest_name} not found for '#{id}'"
706
+ end
707
+ # load type so we can prompt for those option types
708
+ if rest_has_type
709
+ record_type_id = record['type']['id']
710
+ record_type = rest_type_find_by_name_or_id(record_type_id)
711
+ if record_type.nil?
712
+ return 1, "#{rest_type_label} not found for '#{record_type_id}"
713
+ end
714
+ # reload the type by id to get all the details ie. optionTypes
715
+ if record_type['optionTypes'].nil?
716
+ record_type = rest_type_find_by_name_or_id(record_type['id'])
717
+ end
718
+ end
600
719
  passed_options = parse_passed_options(options)
601
- payload = nil
720
+ payload = {}
602
721
  if options[:payload]
603
722
  payload = options[:payload]
604
723
  payload.deep_merge!({rest_object_key => passed_options}) unless passed_options.empty?
605
724
  else
606
725
  record_payload = passed_options
726
+ if rest_has_type && record_type
727
+ # inject type to options for prompting
728
+ # record_payload['type'] = record_type['code']
729
+ # options[:options]['type'] = record_type['code']
730
+ # initialize params for loading optionSource data
731
+ options[:params] ||= {}
732
+ options[:params]['type'] = record_type['code']
733
+ end
734
+ # update options without prompting by default
735
+ if option_types && !option_types.empty?
736
+ api_params = (options[:params] || {}).merge(record_payload) # need to merge in values from record too, ughhh
737
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(option_types, options[:options], @api_client, api_params)
738
+ v_prompt.deep_compact!
739
+ v_prompt.booleanize! # 'on' => true
740
+ record_payload.deep_merge!(v_prompt)
741
+ end
742
+ # options by type
743
+ my_option_types = nil
744
+ if respond_to?("load_option_types_for_#{rest_key}", true)
745
+ my_option_types = send("load_option_types_for_#{rest_key}", record_type, nil)
746
+ else
747
+ my_option_types = record_type ? record_type['optionTypes'] : nil
748
+ end
749
+ if my_option_types && !my_option_types.empty?
750
+ # remove redundant fieldContext
751
+ # make them optional for updates
752
+ # todo: use current value as default instead of just making things optioanl
753
+ # maybe new prompt() options like {:mode => :edit, :object => storage_server} or something
754
+ my_option_types.each do |option_type|
755
+ if option_type['fieldContext'] == rest_object_key
756
+ option_type['fieldContext'] = nil
757
+ end
758
+ option_type.delete('required')
759
+ option_type.delete('defaultValue')
760
+ end
761
+ api_params = (options[:params] || {}).merge(record_payload) # need to merge in values from record too, ughhh
762
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(my_option_types, options[:options], @api_client, api_params)
763
+ v_prompt.deep_compact!
764
+ v_prompt.booleanize! # 'on' => true
765
+ record_payload.deep_merge!(v_prompt)
766
+ end
767
+ # advanced options
768
+ if advanced_option_types && !advanced_option_types.empty?
769
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(advanced_option_types, options[:options], @api_client, options[:params])
770
+ v_prompt.deep_compact!
771
+ v_prompt.booleanize! # 'on' => true
772
+ record_payload.deep_merge!(v_prompt)
773
+ end
774
+ # remove empty config, compact could hanlde this
775
+ if record_payload['config'] && record_payload['config'].empty?
776
+ record_payload.delete('config')
777
+ end
778
+ # prevent updating with empty payload
607
779
  if record_payload.empty?
608
780
  raise_command_error "Specify at least one option to update.\n#{optparse}"
609
781
  end
@@ -629,6 +801,10 @@ EOT
629
801
  optparse = Morpheus::Cli::OptionParser.new do |opts|
630
802
  opts.banner = subcommand_usage("[#{rest_arg}]")
631
803
  build_standard_remove_options(opts, options)
804
+ opts.footer = <<-EOT
805
+ Delete an existing #{rest_label.downcase}.
806
+ [#{rest_arg}] is required. This is the #{rest_has_name ? 'name or id' : 'id'} of #{a_or_an(rest_label)} #{rest_label.downcase}.
807
+ EOT
632
808
  end
633
809
  optparse.parse!(args)
634
810
  verify_args!(args:args, optparse:optparse, count:1)
@@ -643,7 +819,7 @@ EOT
643
819
  end
644
820
  rest_interface.setopts(options)
645
821
  if options[:dry_run]
646
- print_dry_run rest_interface.dry.destroy(record['id'])
822
+ print_dry_run rest_interface.dry.destroy(record['id'], params)
647
823
  return 0, nil
648
824
  end
649
825
  json_response = rest_interface.destroy(record['id'], params)