morpheus-cli 3.5.1.3 → 3.5.2
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.
- checksums.yaml +4 -4
 - data/lib/morpheus/api/instances_interface.rb +7 -0
 - data/lib/morpheus/api/storage_providers_interface.rb +11 -11
 - data/lib/morpheus/cli/accounts.rb +4 -4
 - data/lib/morpheus/cli/apps.rb +67 -16
 - data/lib/morpheus/cli/boot_scripts_command.rb +5 -5
 - data/lib/morpheus/cli/clouds.rb +8 -8
 - data/lib/morpheus/cli/containers_command.rb +29 -6
 - data/lib/morpheus/cli/dashboard_command.rb +1 -1
 - data/lib/morpheus/cli/deployments.rb +5 -5
 - data/lib/morpheus/cli/hosts.rb +46 -23
 - data/lib/morpheus/cli/image_builder_command.rb +6 -6
 - data/lib/morpheus/cli/instances.rb +243 -82
 - data/lib/morpheus/cli/key_pairs.rb +6 -6
 - data/lib/morpheus/cli/load_balancers.rb +6 -6
 - data/lib/morpheus/cli/login.rb +8 -5
 - data/lib/morpheus/cli/logout.rb +1 -1
 - data/lib/morpheus/cli/monitoring_contacts_command.rb +6 -6
 - data/lib/morpheus/cli/monitoring_incidents_command.rb +8 -8
 - data/lib/morpheus/cli/preseed_scripts_command.rb +5 -5
 - data/lib/morpheus/cli/recent_activity_command.rb +1 -1
 - data/lib/morpheus/cli/remote.rb +1 -1
 - data/lib/morpheus/cli/security_group_rules.rb +4 -4
 - data/lib/morpheus/cli/security_groups.rb +5 -5
 - data/lib/morpheus/cli/shell.rb +1 -1
 - data/lib/morpheus/cli/storage_providers_command.rb +78 -78
 - data/lib/morpheus/cli/tasks.rb +5 -5
 - data/lib/morpheus/cli/version.rb +1 -1
 - data/lib/morpheus/cli/version_command.rb +1 -1
 - data/lib/morpheus/cli/whoami.rb +1 -1
 - data/lib/morpheus/cli/workflows.rb +4 -4
 - metadata +2 -2
 
| 
         @@ -29,7 +29,7 @@ class Morpheus::Cli::KeyPairs 
     | 
|
| 
       29 
29 
     | 
    
         
             
              def list(args)
         
     | 
| 
       30 
30 
     | 
    
         
             
                options = {}
         
     | 
| 
       31 
31 
     | 
    
         
             
                params = {}
         
     | 
| 
       32 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 32 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       33 
33 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       34 
34 
     | 
    
         
             
                  build_common_options(opts, options, [:account, :list, :json])
         
     | 
| 
       35 
35 
     | 
    
         
             
                end
         
     | 
| 
         @@ -76,7 +76,7 @@ class Morpheus::Cli::KeyPairs 
     | 
|
| 
       76 
76 
     | 
    
         
             
              def get(args)
         
     | 
| 
       77 
77 
     | 
    
         
             
                options = {}
         
     | 
| 
       78 
78 
     | 
    
         
             
                params = {}
         
     | 
| 
       79 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 79 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       80 
80 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       81 
81 
     | 
    
         
             
                  build_common_options(opts, options, [:account, :json])
         
     | 
| 
       82 
82 
     | 
    
         
             
                end
         
     | 
| 
         @@ -109,7 +109,7 @@ class Morpheus::Cli::KeyPairs 
     | 
|
| 
       109 
109 
     | 
    
         
             
                      "ID" => 'id',
         
     | 
| 
       110 
110 
     | 
    
         
             
                      "Name" => 'name',
         
     | 
| 
       111 
111 
     | 
    
         
             
                      "Fingerprint" => 'fingerprint',
         
     | 
| 
       112 
     | 
    
         
            -
                      "MD5" => 'md5',
         
     | 
| 
      
 112 
     | 
    
         
            +
                      #"MD5" => 'md5',
         
     | 
| 
       113 
113 
     | 
    
         
             
                      # "Has Private Key" => lambda {|it| format_boolean(it['hasPrivateKey']) },
         
     | 
| 
       114 
114 
     | 
    
         
             
                      # "Account" => lambda {|it| it['account'] ? it['account']['name'] : '' },
         
     | 
| 
       115 
115 
     | 
    
         
             
                      "Created" => lambda {|it| format_local_dt(it['dateCreated']) }
         
     | 
| 
         @@ -140,7 +140,7 @@ class Morpheus::Cli::KeyPairs 
     | 
|
| 
       140 
140 
     | 
    
         | 
| 
       141 
141 
     | 
    
         
             
              def add(args)
         
     | 
| 
       142 
142 
     | 
    
         
             
                options = {}
         
     | 
| 
       143 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 143 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       144 
144 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name] [options]")
         
     | 
| 
       145 
145 
     | 
    
         
             
                  opts.on('', '--public-key-file FILENAME', "Public Key File" ) do |filename|
         
     | 
| 
       146 
146 
     | 
    
         
             
                    if File.exists?(File.expand_path(filename))
         
     | 
| 
         @@ -229,7 +229,7 @@ class Morpheus::Cli::KeyPairs 
     | 
|
| 
       229 
229 
     | 
    
         | 
| 
       230 
230 
     | 
    
         
             
              def update(args)
         
     | 
| 
       231 
231 
     | 
    
         
             
                options = {}
         
     | 
| 
       232 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 232 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       233 
233 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name] [options]")
         
     | 
| 
       234 
234 
     | 
    
         
             
                  build_option_type_options(opts, options, update_key_pair_option_types)
         
     | 
| 
       235 
235 
     | 
    
         
             
                  build_common_options(opts, options, [:account, :options, :json, :dry_run])
         
     | 
| 
         @@ -282,7 +282,7 @@ class Morpheus::Cli::KeyPairs 
     | 
|
| 
       282 
282 
     | 
    
         | 
| 
       283 
283 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       284 
284 
     | 
    
         
             
                options = {}
         
     | 
| 
       285 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 285 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       286 
286 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       287 
287 
     | 
    
         
             
                  build_common_options(opts, options, [:account, :auto_confirm, :json, :dry_run])
         
     | 
| 
       288 
288 
     | 
    
         
             
                end
         
     | 
| 
         @@ -27,7 +27,7 @@ class Morpheus::Cli::LoadBalancers 
     | 
|
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
              def list(args)
         
     | 
| 
       29 
29 
     | 
    
         
             
                options = {}
         
     | 
| 
       30 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 30 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       31 
31 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       32 
32 
     | 
    
         
             
                  build_common_options(opts, options, [:list, :json, :csv, :yaml, :fields, :dry_run, :remote])
         
     | 
| 
       33 
33 
     | 
    
         
             
                end
         
     | 
| 
         @@ -78,7 +78,7 @@ class Morpheus::Cli::LoadBalancers 
     | 
|
| 
       78 
78 
     | 
    
         | 
| 
       79 
79 
     | 
    
         
             
              def get(args)
         
     | 
| 
       80 
80 
     | 
    
         
             
                options = {}
         
     | 
| 
       81 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 81 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       82 
82 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       83 
83 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :csv, :yaml, :fields, :dry_run, :remote])
         
     | 
| 
       84 
84 
     | 
    
         
             
                end
         
     | 
| 
         @@ -161,7 +161,7 @@ class Morpheus::Cli::LoadBalancers 
     | 
|
| 
       161 
161 
     | 
    
         
             
                lb_name = args[0]
         
     | 
| 
       162 
162 
     | 
    
         
             
                options = {}
         
     | 
| 
       163 
163 
     | 
    
         
             
                account_name = nil
         
     | 
| 
       164 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 164 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       165 
165 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name] [options]")
         
     | 
| 
       166 
166 
     | 
    
         
             
                  build_common_options(opts, options, [:options, :json, :dry_run, :remote])
         
     | 
| 
       167 
167 
     | 
    
         
             
                end
         
     | 
| 
         @@ -222,7 +222,7 @@ class Morpheus::Cli::LoadBalancers 
     | 
|
| 
       222 
222 
     | 
    
         | 
| 
       223 
223 
     | 
    
         
             
              def lb_types(args)
         
     | 
| 
       224 
224 
     | 
    
         
             
                options = {}
         
     | 
| 
       225 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 225 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       226 
226 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       227 
227 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run, :remote])
         
     | 
| 
       228 
228 
     | 
    
         
             
                end
         
     | 
| 
         @@ -261,7 +261,7 @@ class Morpheus::Cli::LoadBalancers 
     | 
|
| 
       261 
261 
     | 
    
         
             
              def add(args)
         
     | 
| 
       262 
262 
     | 
    
         
             
                lb_type_name = nil
         
     | 
| 
       263 
263 
     | 
    
         
             
                options = {}
         
     | 
| 
       264 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 264 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       265 
265 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name] -t LB_TYPE")
         
     | 
| 
       266 
266 
     | 
    
         
             
                  opts.on( '-t', '--type LB_TYPE', "Load Balancer Type" ) do |val|
         
     | 
| 
       267 
267 
     | 
    
         
             
                    lb_type_name = val
         
     | 
| 
         @@ -305,7 +305,7 @@ class Morpheus::Cli::LoadBalancers 
     | 
|
| 
       305 
305 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       306 
306 
     | 
    
         
             
                lb_name = args[0]
         
     | 
| 
       307 
307 
     | 
    
         
             
                options = {}
         
     | 
| 
       308 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 308 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       309 
309 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       310 
310 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
         
     | 
| 
       311 
311 
     | 
    
         
             
                end
         
     | 
    
        data/lib/morpheus/cli/login.rb
    CHANGED
    
    | 
         @@ -28,7 +28,7 @@ class Morpheus::Cli::Login 
     | 
|
| 
       28 
28 
     | 
    
         
             
              def login(args)
         
     | 
| 
       29 
29 
     | 
    
         
             
                options = {}
         
     | 
| 
       30 
30 
     | 
    
         
             
                username, password = nil, nil
         
     | 
| 
       31 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 31 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       32 
32 
     | 
    
         
             
                  opts.banner = usage
         
     | 
| 
       33 
33 
     | 
    
         
             
                  opts.on( '-u', '--username USERNAME', "Username" ) do |val|
         
     | 
| 
       34 
34 
     | 
    
         
             
                    username = val
         
     | 
| 
         @@ -52,21 +52,21 @@ class Morpheus::Cli::Login 
     | 
|
| 
       52 
52 
     | 
    
         
             
                    @appliance_name, @appliance_url = nil, nil
         
     | 
| 
       53 
53 
     | 
    
         
             
                  end
         
     | 
| 
       54 
54 
     | 
    
         
             
                  if !@appliance_name
         
     | 
| 
       55 
     | 
    
         
            -
                     
     | 
| 
      
 55 
     | 
    
         
            +
                    print_error red, "You have no appliance named '#{options[:remote]}' configured. See the `remote list` command.", reset, "\n"
         
     | 
| 
       56 
56 
     | 
    
         
             
                    return false
         
     | 
| 
       57 
57 
     | 
    
         
             
                  end
         
     | 
| 
       58 
58 
     | 
    
         
             
                else
         
     | 
| 
       59 
59 
     | 
    
         
             
                  @appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance
         
     | 
| 
       60 
60 
     | 
    
         
             
                  if !@appliance_name
         
     | 
| 
       61 
     | 
    
         
            -
                     
     | 
| 
      
 61 
     | 
    
         
            +
                    print_error yellow, "Please specify a remote appliance with -r or see the command `remote use`", reset, "\n"
         
     | 
| 
       62 
62 
     | 
    
         
             
                    return false
         
     | 
| 
       63 
63 
     | 
    
         
             
                  end
         
     | 
| 
       64 
64 
     | 
    
         
             
                end
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
66 
     | 
    
         
             
                begin
         
     | 
| 
       67 
67 
     | 
    
         
             
                  if options[:quiet]
         
     | 
| 
       68 
     | 
    
         
            -
                    if !options[:remote_token] && (username 
     | 
| 
       69 
     | 
    
         
            -
                       
     | 
| 
      
 68 
     | 
    
         
            +
                    if ((!options[:remote_token]) && !(username && password))
         
     | 
| 
      
 69 
     | 
    
         
            +
                      print_error yellow,"Please specify a username and password, or token.", reset, "\n"
         
     | 
| 
       70 
70 
     | 
    
         
             
                      return false
         
     | 
| 
       71 
71 
     | 
    
         
             
                    end
         
     | 
| 
       72 
72 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -86,6 +86,9 @@ class Morpheus::Cli::Login 
     | 
|
| 
       86 
86 
     | 
    
         
             
                  end
         
     | 
| 
       87 
87 
     | 
    
         | 
| 
       88 
88 
     | 
    
         
             
                  if creds
         
     | 
| 
      
 89 
     | 
    
         
            +
                    if !options[:quiet]
         
     | 
| 
      
 90 
     | 
    
         
            +
                      print green,"Logged in to #{@appliance_name} as #{::Morpheus::Cli::Remote.load_active_remote()[:username]}#{reset}", reset, "\n"
         
     | 
| 
      
 91 
     | 
    
         
            +
                    end
         
     | 
| 
       89 
92 
     | 
    
         
             
                    return 0 # ,  nil
         
     | 
| 
       90 
93 
     | 
    
         
             
                  else
         
     | 
| 
       91 
94 
     | 
    
         
             
                    return 1 # , "Login failed"
         
     | 
    
        data/lib/morpheus/cli/logout.rb
    CHANGED
    
    
| 
         @@ -32,7 +32,7 @@ class Morpheus::Cli::MonitoringContactsCommand 
     | 
|
| 
       32 
32 
     | 
    
         
             
              def list(args)
         
     | 
| 
       33 
33 
     | 
    
         
             
                options = {}
         
     | 
| 
       34 
34 
     | 
    
         
             
                params = {}
         
     | 
| 
       35 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 35 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       36 
36 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       37 
37 
     | 
    
         
             
                  build_common_options(opts, options, [:list, :json, :csv, :yaml, :fields, :json, :dry_run])
         
     | 
| 
       38 
38 
     | 
    
         
             
                end
         
     | 
| 
         @@ -82,7 +82,7 @@ class Morpheus::Cli::MonitoringContactsCommand 
     | 
|
| 
       82 
82 
     | 
    
         | 
| 
       83 
83 
     | 
    
         
             
              def get(args)
         
     | 
| 
       84 
84 
     | 
    
         
             
                options = {}
         
     | 
| 
       85 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 85 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       86 
86 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       87 
87 
     | 
    
         
             
                  opts.on(nil,'--history', "Display History") do |val|
         
     | 
| 
       88 
88 
     | 
    
         
             
                    options[:show_history] = true
         
     | 
| 
         @@ -152,7 +152,7 @@ class Morpheus::Cli::MonitoringContactsCommand 
     | 
|
| 
       152 
152 
     | 
    
         
             
              def add(args)
         
     | 
| 
       153 
153 
     | 
    
         
             
                options = {}
         
     | 
| 
       154 
154 
     | 
    
         
             
                params = {}
         
     | 
| 
       155 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 155 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       156 
156 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id]")
         
     | 
| 
       157 
157 
     | 
    
         
             
                  opts.on("--name STRING", String, "Contact name") do |val|
         
     | 
| 
       158 
158 
     | 
    
         
             
                    params['name'] = val
         
     | 
| 
         @@ -207,7 +207,7 @@ class Morpheus::Cli::MonitoringContactsCommand 
     | 
|
| 
       207 
207 
     | 
    
         
             
              def update(args)
         
     | 
| 
       208 
208 
     | 
    
         
             
                options = {}
         
     | 
| 
       209 
209 
     | 
    
         
             
                params = {}
         
     | 
| 
       210 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 210 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       211 
211 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id]")
         
     | 
| 
       212 
212 
     | 
    
         
             
                  opts.on("--name STRING", String, "Contact name") do |val|
         
     | 
| 
       213 
213 
     | 
    
         
             
                    params['name'] = val
         
     | 
| 
         @@ -266,7 +266,7 @@ class Morpheus::Cli::MonitoringContactsCommand 
     | 
|
| 
       266 
266 
     | 
    
         | 
| 
       267 
267 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       268 
268 
     | 
    
         
             
                options = {}
         
     | 
| 
       269 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 269 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       270 
270 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       271 
271 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
         
     | 
| 
       272 
272 
     | 
    
         
             
                end
         
     | 
| 
         @@ -307,7 +307,7 @@ class Morpheus::Cli::MonitoringContactsCommand 
     | 
|
| 
       307 
307 
     | 
    
         | 
| 
       308 
308 
     | 
    
         
             
              def reopen(args)
         
     | 
| 
       309 
309 
     | 
    
         
             
                options = {}
         
     | 
| 
       310 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 310 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       311 
311 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       312 
312 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
         
     | 
| 
       313 
313 
     | 
    
         
             
                end
         
     | 
| 
         @@ -20,7 +20,7 @@ class Morpheus::Cli::MonitoringIncidentsCommand 
     | 
|
| 
       20 
20 
     | 
    
         
             
              def list(args)
         
     | 
| 
       21 
21 
     | 
    
         
             
                options = {}
         
     | 
| 
       22 
22 
     | 
    
         
             
                params = {}
         
     | 
| 
       23 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 23 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       24 
24 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       25 
25 
     | 
    
         
             
                  opts.on('--status LIST', Array, "Filter by status. open, closed") do |list|
         
     | 
| 
       26 
26 
     | 
    
         
             
                    params['status'] = list
         
     | 
| 
         @@ -72,7 +72,7 @@ class Morpheus::Cli::MonitoringIncidentsCommand 
     | 
|
| 
       72 
72 
     | 
    
         
             
              # it is not stats about a particular incident
         
     | 
| 
       73 
73 
     | 
    
         
             
              def stats(args)
         
     | 
| 
       74 
74 
     | 
    
         
             
                options = {}
         
     | 
| 
       75 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 75 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       76 
76 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       77 
77 
     | 
    
         
             
                  #opts.on('-j','--json', "JSON Output") do
         
     | 
| 
       78 
78 
     | 
    
         
             
                  opts.on( '-m', '--max MAX', "Max open incidents to display. Default is 25" ) do |max|
         
     | 
| 
         @@ -157,7 +157,7 @@ class Morpheus::Cli::MonitoringIncidentsCommand 
     | 
|
| 
       157 
157 
     | 
    
         | 
| 
       158 
158 
     | 
    
         
             
              def get(args)
         
     | 
| 
       159 
159 
     | 
    
         
             
                options = {}
         
     | 
| 
       160 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 160 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       161 
161 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       162 
162 
     | 
    
         
             
                  opts.on(nil,'--history', "Display Incident History") do |val|
         
     | 
| 
       163 
163 
     | 
    
         
             
                    options[:show_history] = true
         
     | 
| 
         @@ -280,7 +280,7 @@ class Morpheus::Cli::MonitoringIncidentsCommand 
     | 
|
| 
       280 
280 
     | 
    
         
             
              def history(args)
         
     | 
| 
       281 
281 
     | 
    
         
             
                options = {}
         
     | 
| 
       282 
282 
     | 
    
         
             
                params = {}
         
     | 
| 
       283 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 283 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       284 
284 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id] [options]")
         
     | 
| 
       285 
285 
     | 
    
         
             
                  opts.on('--severity LIST', Array, "Filter by severity. critical, warning, info") do |list|
         
     | 
| 
       286 
286 
     | 
    
         
             
                    params['severity'] = list
         
     | 
| 
         @@ -335,7 +335,7 @@ class Morpheus::Cli::MonitoringIncidentsCommand 
     | 
|
| 
       335 
335 
     | 
    
         | 
| 
       336 
336 
     | 
    
         
             
              def notifications(args)
         
     | 
| 
       337 
337 
     | 
    
         
             
                options = {}
         
     | 
| 
       338 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 338 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       339 
339 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id] [options]")
         
     | 
| 
       340 
340 
     | 
    
         
             
                  build_common_options(opts, options, [:list, :json, :csv, :yaml, :fields, :json, :dry_run, :remote])
         
     | 
| 
       341 
341 
     | 
    
         
             
                end
         
     | 
| 
         @@ -388,7 +388,7 @@ class Morpheus::Cli::MonitoringIncidentsCommand 
     | 
|
| 
       388 
388 
     | 
    
         
             
              def update(args)
         
     | 
| 
       389 
389 
     | 
    
         
             
                options = {}
         
     | 
| 
       390 
390 
     | 
    
         
             
                params = {}
         
     | 
| 
       391 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 391 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       392 
392 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id]")
         
     | 
| 
       393 
393 
     | 
    
         
             
                  opts.on("-c", "--comment STRING", String, "Comment on this incident") do |val|
         
     | 
| 
       394 
394 
     | 
    
         
             
                    params['comment'] = val == 'null' ? nil : val
         
     | 
| 
         @@ -565,7 +565,7 @@ class Morpheus::Cli::MonitoringIncidentsCommand 
     | 
|
| 
       565 
565 
     | 
    
         | 
| 
       566 
566 
     | 
    
         
             
              def close(args)
         
     | 
| 
       567 
567 
     | 
    
         
             
                options = {}
         
     | 
| 
       568 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 568 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       569 
569 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       570 
570 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
         
     | 
| 
       571 
571 
     | 
    
         
             
                end
         
     | 
| 
         @@ -609,7 +609,7 @@ class Morpheus::Cli::MonitoringIncidentsCommand 
     | 
|
| 
       609 
609 
     | 
    
         | 
| 
       610 
610 
     | 
    
         
             
              def reopen(args)
         
     | 
| 
       611 
611 
     | 
    
         
             
                options = {}
         
     | 
| 
       612 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 612 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       613 
613 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id list]")
         
     | 
| 
       614 
614 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
         
     | 
| 
       615 
615 
     | 
    
         
             
                end
         
     | 
| 
         @@ -34,7 +34,7 @@ class Morpheus::Cli::PreseedScriptsCommand 
     | 
|
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
              def list(args)
         
     | 
| 
       36 
36 
     | 
    
         
             
                options = {}
         
     | 
| 
       37 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 37 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       38 
38 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       39 
39 
     | 
    
         
             
                  build_common_options(opts, options, [:list, :json, :dry_run])
         
     | 
| 
       40 
40 
     | 
    
         
             
                end
         
     | 
| 
         @@ -92,7 +92,7 @@ class Morpheus::Cli::PreseedScriptsCommand 
     | 
|
| 
       92 
92 
     | 
    
         | 
| 
       93 
93 
     | 
    
         
             
              def get(args)
         
     | 
| 
       94 
94 
     | 
    
         
             
                options = {}
         
     | 
| 
       95 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 95 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       96 
96 
     | 
    
         
             
                  opts.banner = subcommand_usage("[preseed-script]")
         
     | 
| 
       97 
97 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run])
         
     | 
| 
       98 
98 
     | 
    
         
             
                end
         
     | 
| 
         @@ -146,7 +146,7 @@ class Morpheus::Cli::PreseedScriptsCommand 
     | 
|
| 
       146 
146 
     | 
    
         | 
| 
       147 
147 
     | 
    
         
             
              def add(args)
         
     | 
| 
       148 
148 
     | 
    
         
             
                options = {}
         
     | 
| 
       149 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 149 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       150 
150 
     | 
    
         
             
                  opts.banner = subcommand_usage("[fileName]")
         
     | 
| 
       151 
151 
     | 
    
         
             
                  build_option_type_options(opts, options, add_preseed_script_option_types(false))
         
     | 
| 
       152 
152 
     | 
    
         
             
                  build_common_options(opts, options, [:options, :json, :dry_run, :quiet])
         
     | 
| 
         @@ -205,7 +205,7 @@ class Morpheus::Cli::PreseedScriptsCommand 
     | 
|
| 
       205 
205 
     | 
    
         | 
| 
       206 
206 
     | 
    
         
             
              def update(args)
         
     | 
| 
       207 
207 
     | 
    
         
             
                options = {}
         
     | 
| 
       208 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 208 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       209 
209 
     | 
    
         
             
                  opts.banner = subcommand_usage("[preseed-script] [options]")
         
     | 
| 
       210 
210 
     | 
    
         
             
                  build_option_type_options(opts, options, update_preseed_script_option_types(false))
         
     | 
| 
       211 
211 
     | 
    
         
             
                  build_common_options(opts, options, [:options, :json, :dry_run])
         
     | 
| 
         @@ -275,7 +275,7 @@ class Morpheus::Cli::PreseedScriptsCommand 
     | 
|
| 
       275 
275 
     | 
    
         | 
| 
       276 
276 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       277 
277 
     | 
    
         
             
                options = {}
         
     | 
| 
       278 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 278 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       279 
279 
     | 
    
         
             
                  opts.banner = subcommand_usage("[preseed-script]")
         
     | 
| 
       280 
280 
     | 
    
         
             
                  build_common_options(opts, options, [:account, :auto_confirm, :json, :dry_run])
         
     | 
| 
       281 
281 
     | 
    
         
             
                end
         
     | 
| 
         @@ -28,7 +28,7 @@ class Morpheus::Cli::RecentActivityCommand 
     | 
|
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         
             
              def list(args)
         
     | 
| 
       30 
30 
     | 
    
         
             
                options = {}
         
     | 
| 
       31 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 31 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       32 
32 
     | 
    
         
             
                  opts.banner = usage
         
     | 
| 
       33 
33 
     | 
    
         
             
                  opts.on('--start TIMESTAMP','--start TIMESTAMP', "Start timestamp. Default is 30 days ago.") do |val|
         
     | 
| 
       34 
34 
     | 
    
         
             
                    options[:start] = parse_time(val).iso8601
         
     | 
    
        data/lib/morpheus/cli/remote.rb
    CHANGED
    
    | 
         @@ -431,7 +431,7 @@ EOT 
     | 
|
| 
       431 
431 
     | 
    
         | 
| 
       432 
432 
     | 
    
         
             
              def get(args)
         
     | 
| 
       433 
433 
     | 
    
         
             
                options = {}
         
     | 
| 
       434 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 434 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       435 
435 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name]")
         
     | 
| 
       436 
436 
     | 
    
         
             
                  build_common_options(opts, options, [:json,:csv, :fields, :quiet])
         
     | 
| 
       437 
437 
     | 
    
         
             
                end
         
     | 
| 
         @@ -31,7 +31,7 @@ Usage: morpheus #{command_name} add-custom-rule SOURCE_CIDR PORT_RANGE PROTOCOL 
     | 
|
| 
       31 
31 
     | 
    
         
             
            EOT
         
     | 
| 
       32 
32 
     | 
    
         
             
                options = {}
         
     | 
| 
       33 
33 
     | 
    
         
             
                security_group_id = nil
         
     | 
| 
       34 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 34 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       35 
35 
     | 
    
         
             
                  opts.banner = usage
         
     | 
| 
       36 
36 
     | 
    
         
             
                  opts.on( '-s', '--secgroup SECGROUP', "Security Group ID (Use will use security as set with 'security-groups use id'" ) do |id|
         
     | 
| 
       37 
37 
     | 
    
         
             
                    security_group_id = id
         
     | 
| 
         @@ -90,7 +90,7 @@ EOT 
     | 
|
| 
       90 
90 
     | 
    
         | 
| 
       91 
91 
     | 
    
         
             
                options = {}
         
     | 
| 
       92 
92 
     | 
    
         
             
                security_group_id = nil
         
     | 
| 
       93 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 93 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       94 
94 
     | 
    
         
             
                  opts.banner = usage
         
     | 
| 
       95 
95 
     | 
    
         
             
                  opts.on( '-s', '--secgroup secgroup', "Security Group ID (Use will use security as set with 'security-groups use id'" ) do |id|
         
     | 
| 
       96 
96 
     | 
    
         
             
                    security_group_id = id
         
     | 
| 
         @@ -139,7 +139,7 @@ EOT 
     | 
|
| 
       139 
139 
     | 
    
         
             
              def list(args)
         
     | 
| 
       140 
140 
     | 
    
         
             
                options = {}
         
     | 
| 
       141 
141 
     | 
    
         
             
                security_group_id = nil
         
     | 
| 
       142 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 142 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       143 
143 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id]")
         
     | 
| 
       144 
144 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run])
         
     | 
| 
       145 
145 
     | 
    
         
             
                end
         
     | 
| 
         @@ -186,7 +186,7 @@ EOT 
     | 
|
| 
       186 
186 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       187 
187 
     | 
    
         
             
                options = {}
         
     | 
| 
       188 
188 
     | 
    
         
             
                security_group_id = nil
         
     | 
| 
       189 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 189 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       190 
190 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id] [options]")
         
     | 
| 
       191 
191 
     | 
    
         
             
                  opts.on( '-s', '--secgroup secgroup', "Security Group ID (Use will use security as set with 'security-groups use id'" ) do |id|
         
     | 
| 
       192 
192 
     | 
    
         
             
                    security_group_id = id
         
     | 
| 
         @@ -25,7 +25,7 @@ class Morpheus::Cli::SecurityGroups 
     | 
|
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
              def list(args)
         
     | 
| 
       27 
27 
     | 
    
         
             
                options = {}
         
     | 
| 
       28 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 28 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       29 
29 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       30 
30 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run])
         
     | 
| 
       31 
31 
     | 
    
         
             
                end
         
     | 
| 
         @@ -69,7 +69,7 @@ class Morpheus::Cli::SecurityGroups 
     | 
|
| 
       69 
69 
     | 
    
         | 
| 
       70 
70 
     | 
    
         
             
              def get(args)
         
     | 
| 
       71 
71 
     | 
    
         
             
                options = {}
         
     | 
| 
       72 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 72 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       73 
73 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id]")
         
     | 
| 
       74 
74 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run])
         
     | 
| 
       75 
75 
     | 
    
         
             
                end
         
     | 
| 
         @@ -110,7 +110,7 @@ class Morpheus::Cli::SecurityGroups 
     | 
|
| 
       110 
110 
     | 
    
         
             
              def add(args)
         
     | 
| 
       111 
111 
     | 
    
         
             
                params = {:securityGroup => {}}
         
     | 
| 
       112 
112 
     | 
    
         
             
                options = {}
         
     | 
| 
       113 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 113 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       114 
114 
     | 
    
         
             
                  opts.banner = subcommand_usage("[name] [options]")
         
     | 
| 
       115 
115 
     | 
    
         
             
                  opts.on( '-d', '--description Description', "Description of the security group" ) do |description|
         
     | 
| 
       116 
116 
     | 
    
         
             
                    params[:securityGroup][:description] = description
         
     | 
| 
         @@ -144,7 +144,7 @@ class Morpheus::Cli::SecurityGroups 
     | 
|
| 
       144 
144 
     | 
    
         | 
| 
       145 
145 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       146 
146 
     | 
    
         
             
                options = {}
         
     | 
| 
       147 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 147 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       148 
148 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id]")
         
     | 
| 
       149 
149 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :dry_run])
         
     | 
| 
       150 
150 
     | 
    
         
             
                end
         
     | 
| 
         @@ -180,7 +180,7 @@ class Morpheus::Cli::SecurityGroups 
     | 
|
| 
       180 
180 
     | 
    
         | 
| 
       181 
181 
     | 
    
         
             
              def use(args)
         
     | 
| 
       182 
182 
     | 
    
         
             
                options = {}
         
     | 
| 
       183 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 183 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       184 
184 
     | 
    
         
             
                  opts.banner = subcommand_usage("[id] [--none]")
         
     | 
| 
       185 
185 
     | 
    
         
             
                  opts.on('--none','--none', "Do not use an active group.") do |json|
         
     | 
| 
       186 
186 
     | 
    
         
             
                    options[:unuse] = true
         
     | 
    
        data/lib/morpheus/cli/shell.rb
    CHANGED
    
    | 
         @@ -111,7 +111,7 @@ class Morpheus::Cli::Shell 
     | 
|
| 
       111 
111 
     | 
    
         | 
| 
       112 
112 
     | 
    
         
             
              def handle(args)
         
     | 
| 
       113 
113 
     | 
    
         
             
                usage = "Usage: morpheus #{command_name}"
         
     | 
| 
       114 
     | 
    
         
            -
                optparse = OptionParser.new do|opts|
         
     | 
| 
      
 114 
     | 
    
         
            +
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       115 
115 
     | 
    
         
             
                  opts.banner = usage
         
     | 
| 
       116 
116 
     | 
    
         
             
                  # change to a temporary home directory, delete it afterwards.
         
     | 
| 
       117 
117 
     | 
    
         
             
                  opts.on('-e','--exec COMMAND', "Execute the provided morpheus commands and exit.") do |val|
         
     | 
| 
         @@ -9,7 +9,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       9 
9 
     | 
    
         
             
              include Morpheus::Cli::CliCommand
         
     | 
| 
       10 
10 
     | 
    
         
             
              include Morpheus::Cli::InfrastructureHelper
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
              set_command_name :'storage- 
     | 
| 
      
 12 
     | 
    
         
            +
              set_command_name :'storage-buckets'
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              register_subcommands :list, :get, :add, :update, :remove
         
     | 
| 
       15 
15 
     | 
    
         
             
              # file commands
         
     | 
| 
         @@ -46,7 +46,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       46 
46 
     | 
    
         
             
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       47 
47 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       48 
48 
     | 
    
         
             
                  build_common_options(opts, options, [:list, :json, :yaml, :csv, :fields, :json, :dry_run, :remote])
         
     | 
| 
       49 
     | 
    
         
            -
                  opts.footer = "List storage  
     | 
| 
      
 49 
     | 
    
         
            +
                  opts.footer = "List storage buckets."
         
     | 
| 
       50 
50 
     | 
    
         
             
                end
         
     | 
| 
       51 
51 
     | 
    
         
             
                optparse.parse!(args)
         
     | 
| 
       52 
52 
     | 
    
         
             
                if args.count != 0
         
     | 
| 
         @@ -62,23 +62,23 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       62 
62 
     | 
    
         
             
                    return
         
     | 
| 
       63 
63 
     | 
    
         
             
                  end
         
     | 
| 
       64 
64 
     | 
    
         
             
                  json_response = @storage_providers_interface.list(params)
         
     | 
| 
       65 
     | 
    
         
            -
                  storage_providers = json_response[" 
     | 
| 
      
 65 
     | 
    
         
            +
                  storage_providers = json_response["storageBuckets"]
         
     | 
| 
       66 
66 
     | 
    
         
             
                  if options[:json]
         
     | 
| 
       67 
     | 
    
         
            -
                    puts as_json(json_response, options, " 
     | 
| 
      
 67 
     | 
    
         
            +
                    puts as_json(json_response, options, "storageBuckets")
         
     | 
| 
       68 
68 
     | 
    
         
             
                    return 0
         
     | 
| 
       69 
69 
     | 
    
         
             
                  elsif options[:yaml]
         
     | 
| 
       70 
     | 
    
         
            -
                    puts as_yaml(json_response, options, " 
     | 
| 
      
 70 
     | 
    
         
            +
                    puts as_yaml(json_response, options, "storageBuckets")
         
     | 
| 
       71 
71 
     | 
    
         
             
                    return 0
         
     | 
| 
       72 
72 
     | 
    
         
             
                  elsif options[:csv]
         
     | 
| 
       73 
73 
     | 
    
         
             
                    puts records_as_csv(storage_providers, options)
         
     | 
| 
       74 
74 
     | 
    
         
             
                    return 0
         
     | 
| 
       75 
75 
     | 
    
         
             
                  end
         
     | 
| 
       76 
     | 
    
         
            -
                  title = "Morpheus Storage  
     | 
| 
      
 76 
     | 
    
         
            +
                  title = "Morpheus Storage Buckets"
         
     | 
| 
       77 
77 
     | 
    
         
             
                  subtitles = []
         
     | 
| 
       78 
78 
     | 
    
         
             
                  subtitles += parse_list_subtitles(options)
         
     | 
| 
       79 
79 
     | 
    
         
             
                  print_h1 title, subtitles
         
     | 
| 
       80 
80 
     | 
    
         
             
                  if storage_providers.empty?
         
     | 
| 
       81 
     | 
    
         
            -
                    print cyan,"No storage  
     | 
| 
      
 81 
     | 
    
         
            +
                    print cyan,"No storage buckets found.",reset,"\n"
         
     | 
| 
       82 
82 
     | 
    
         
             
                  else
         
     | 
| 
       83 
83 
     | 
    
         
             
                    rows = storage_providers.collect {|storage_provider| 
         
     | 
| 
       84 
84 
     | 
    
         
             
                      row = {
         
     | 
| 
         @@ -100,7 +100,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       100 
100 
     | 
    
         
             
                    print cyan
         
     | 
| 
       101 
101 
     | 
    
         
             
                    print as_pretty_table(rows, columns, options)
         
     | 
| 
       102 
102 
     | 
    
         
             
                    print reset
         
     | 
| 
       103 
     | 
    
         
            -
                    print_results_pagination(json_response, {:label => "storage  
     | 
| 
      
 103 
     | 
    
         
            +
                    print_results_pagination(json_response, {:label => "storage bucket", :n_label => "storage buckets"})
         
     | 
| 
       104 
104 
     | 
    
         
             
                  end
         
     | 
| 
       105 
105 
     | 
    
         
             
                  print reset,"\n"
         
     | 
| 
       106 
106 
     | 
    
         
             
                  return 0
         
     | 
| 
         @@ -113,15 +113,15 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       113 
113 
     | 
    
         
             
              def get(args)
         
     | 
| 
       114 
114 
     | 
    
         
             
                options = {}
         
     | 
| 
       115 
115 
     | 
    
         
             
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       116 
     | 
    
         
            -
                  opts.banner = subcommand_usage("[storage- 
     | 
| 
      
 116 
     | 
    
         
            +
                  opts.banner = subcommand_usage("[storage-bucket]")
         
     | 
| 
       117 
117 
     | 
    
         
             
                  build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
         
     | 
| 
       118 
     | 
    
         
            -
                  opts.footer = "Get details about a storage  
     | 
| 
       119 
     | 
    
         
            -
                                "[storage- 
     | 
| 
      
 118 
     | 
    
         
            +
                  opts.footer = "Get details about a storage bucket." + "\n" +
         
     | 
| 
      
 119 
     | 
    
         
            +
                                "[storage-bucket] is required. This is the name or id of a storage bucket."
         
     | 
| 
       120 
120 
     | 
    
         
             
                end
         
     | 
| 
       121 
121 
     | 
    
         
             
                optparse.parse!(args)
         
     | 
| 
       122 
122 
     | 
    
         
             
                if args.count != 1
         
     | 
| 
       123 
123 
     | 
    
         
             
                  print_error Morpheus::Terminal.angry_prompt
         
     | 
| 
       124 
     | 
    
         
            -
                  puts_error  "#{command_name} missing argument: [storage- 
     | 
| 
      
 124 
     | 
    
         
            +
                  puts_error  "#{command_name} missing argument: [storage-bucket]\n#{optparse}"
         
     | 
| 
       125 
125 
     | 
    
         
             
                  return 1
         
     | 
| 
       126 
126 
     | 
    
         
             
                end
         
     | 
| 
       127 
127 
     | 
    
         
             
                connect(options)
         
     | 
| 
         @@ -136,20 +136,20 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       136 
136 
     | 
    
         
             
                  end
         
     | 
| 
       137 
137 
     | 
    
         
             
                  storage_provider = find_storage_provider_by_name_or_id(args[0])
         
     | 
| 
       138 
138 
     | 
    
         
             
                  return 1 if storage_provider.nil?
         
     | 
| 
       139 
     | 
    
         
            -
                  json_response = {' 
     | 
| 
      
 139 
     | 
    
         
            +
                  json_response = {'storageBucket' => storage_provider}  # skip redundant request
         
     | 
| 
       140 
140 
     | 
    
         
             
                  # json_response = @storage_providers_interface.get(storage_provider['id'])
         
     | 
| 
       141 
     | 
    
         
            -
                  storage_provider = json_response[' 
     | 
| 
      
 141 
     | 
    
         
            +
                  storage_provider = json_response['storageBucket']
         
     | 
| 
       142 
142 
     | 
    
         
             
                  if options[:json]
         
     | 
| 
       143 
     | 
    
         
            -
                    puts as_json(json_response, options, " 
     | 
| 
      
 143 
     | 
    
         
            +
                    puts as_json(json_response, options, "storageBucket")
         
     | 
| 
       144 
144 
     | 
    
         
             
                    return 0
         
     | 
| 
       145 
145 
     | 
    
         
             
                  elsif options[:yaml]
         
     | 
| 
       146 
     | 
    
         
            -
                    puts as_yaml(json_response, options, " 
     | 
| 
      
 146 
     | 
    
         
            +
                    puts as_yaml(json_response, options, "storageBucket")
         
     | 
| 
       147 
147 
     | 
    
         
             
                    return 0
         
     | 
| 
       148 
148 
     | 
    
         
             
                  elsif options[:csv]
         
     | 
| 
       149 
149 
     | 
    
         
             
                    puts records_as_csv([storage_provider], options)
         
     | 
| 
       150 
150 
     | 
    
         
             
                    return 0
         
     | 
| 
       151 
151 
     | 
    
         
             
                  end
         
     | 
| 
       152 
     | 
    
         
            -
                  print_h1 "Storage  
     | 
| 
      
 152 
     | 
    
         
            +
                  print_h1 "Storage Bucket Details"
         
     | 
| 
       153 
153 
     | 
    
         
             
                  print cyan
         
     | 
| 
       154 
154 
     | 
    
         
             
                  description_cols = {
         
     | 
| 
       155 
155 
     | 
    
         
             
                    "ID" => 'id',
         
     | 
| 
         @@ -176,10 +176,10 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       176 
176 
     | 
    
         
             
                create_bucket = nil
         
     | 
| 
       177 
177 
     | 
    
         
             
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       178 
178 
     | 
    
         
             
                  opts.banner = subcommand_usage()
         
     | 
| 
       179 
     | 
    
         
            -
                  opts.on('--name VALUE', String, "Name for this storage  
     | 
| 
      
 179 
     | 
    
         
            +
                  opts.on('--name VALUE', String, "Name for this storage bucket") do |val|
         
     | 
| 
       180 
180 
     | 
    
         
             
                    options['name'] = val
         
     | 
| 
       181 
181 
     | 
    
         
             
                  end
         
     | 
| 
       182 
     | 
    
         
            -
                  opts.on('--type code', String, "Storage  
     | 
| 
      
 182 
     | 
    
         
            +
                  opts.on('--type code', String, "Storage Bucket Type Code") do |val|
         
     | 
| 
       183 
183 
     | 
    
         
             
                    options['providerType'] = val
         
     | 
| 
       184 
184 
     | 
    
         
             
                  end
         
     | 
| 
       185 
185 
     | 
    
         
             
                  opts.on('--bucket-name VALUE', String, "Bucket Name") do |val|
         
     | 
| 
         @@ -201,7 +201,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       201 
201 
     | 
    
         
             
                  #  create_bucket = val.to_s == 'on' || val.to_s == 'true' || val.nil?
         
     | 
| 
       202 
202 
     | 
    
         
             
                  #end
         
     | 
| 
       203 
203 
     | 
    
         
             
                  build_common_options(opts, options, [:options, :payload, :json, :dry_run, :quiet, :remote])
         
     | 
| 
       204 
     | 
    
         
            -
                  opts.footer = "Create a new storage  
     | 
| 
      
 204 
     | 
    
         
            +
                  opts.footer = "Create a new storage bucket." + "\n" +
         
     | 
| 
       205 
205 
     | 
    
         
             
                                "[name] is required and can be passed as --name instead."
         
     | 
| 
       206 
206 
     | 
    
         
             
                end
         
     | 
| 
       207 
207 
     | 
    
         
             
                optparse.parse!(args)
         
     | 
| 
         @@ -225,35 +225,35 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       225 
225 
     | 
    
         
             
                  if options[:payload]
         
     | 
| 
       226 
226 
     | 
    
         
             
                    payload = options[:payload]
         
     | 
| 
       227 
227 
     | 
    
         
             
                  else
         
     | 
| 
       228 
     | 
    
         
            -
                    # prompt for storage  
     | 
| 
      
 228 
     | 
    
         
            +
                    # prompt for storage bucket options
         
     | 
| 
       229 
229 
     | 
    
         
             
                    payload = {
         
     | 
| 
       230 
     | 
    
         
            -
                      ' 
     | 
| 
      
 230 
     | 
    
         
            +
                      'storageBucket' => {
         
     | 
| 
       231 
231 
     | 
    
         
             
                        # 'config' => {}
         
     | 
| 
       232 
232 
     | 
    
         
             
                      }
         
     | 
| 
       233 
233 
     | 
    
         
             
                    }
         
     | 
| 
       234 
234 
     | 
    
         | 
| 
       235 
235 
     | 
    
         
             
                    # allow arbitrary -O options
         
     | 
| 
       236 
     | 
    
         
            -
                    payload[' 
     | 
| 
      
 236 
     | 
    
         
            +
                    payload['storageBucket'].deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) }) if options[:options]
         
     | 
| 
       237 
237 
     | 
    
         | 
| 
       238 
238 
     | 
    
         
             
                    # Name
         
     | 
| 
       239 
239 
     | 
    
         
             
                    if options['name']
         
     | 
| 
       240 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 240 
     | 
    
         
            +
                      payload['storageBucket']['name'] = options['name']
         
     | 
| 
       241 
241 
     | 
    
         
             
                    else
         
     | 
| 
       242 
     | 
    
         
            -
                      v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true, 'description' => 'Name for this storage  
     | 
| 
       243 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 242 
     | 
    
         
            +
                      v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true, 'description' => 'Name for this storage bucket.'}], options)
         
     | 
| 
      
 243 
     | 
    
         
            +
                      payload['storageBucket']['name'] = v_prompt['name']
         
     | 
| 
       244 
244 
     | 
    
         
             
                    end
         
     | 
| 
       245 
245 
     | 
    
         | 
| 
       246 
     | 
    
         
            -
                    # Storage  
     | 
| 
      
 246 
     | 
    
         
            +
                    # Storage Bucket Type
         
     | 
| 
       247 
247 
     | 
    
         
             
                    storage_provider_type_code = nil
         
     | 
| 
       248 
248 
     | 
    
         
             
                    if options['type']
         
     | 
| 
       249 
249 
     | 
    
         
             
                      storage_provider_type_code = options['type'].to_s
         
     | 
| 
       250 
250 
     | 
    
         
             
                    elsif options['providerType']
         
     | 
| 
       251 
251 
     | 
    
         
             
                      storage_provider_type_code = options['providerType'].to_s
         
     | 
| 
       252 
252 
     | 
    
         
             
                    else
         
     | 
| 
       253 
     | 
    
         
            -
                      v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'providerType', 'fieldLabel' => 'Provider Type', 'type' => 'select', 'selectOptions' => get_storage_provider_types(), 'required' => true, 'description' => 'Choose a storage  
     | 
| 
      
 253 
     | 
    
         
            +
                      v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'providerType', 'fieldLabel' => 'Provider Type', 'type' => 'select', 'selectOptions' => get_storage_provider_types(), 'required' => true, 'description' => 'Choose a storage bucket type.'}], options, @api_client, {})
         
     | 
| 
       254 
254 
     | 
    
         
             
                      storage_provider_type_code = v_prompt['providerType'] unless v_prompt['providerType'].nil?
         
     | 
| 
       255 
255 
     | 
    
         
             
                    end
         
     | 
| 
       256 
     | 
    
         
            -
                    payload[' 
     | 
| 
      
 256 
     | 
    
         
            +
                    payload['storageBucket']['providerType'] = storage_provider_type_code
         
     | 
| 
       257 
257 
     | 
    
         | 
| 
       258 
258 
     | 
    
         
             
                    # Provider Type Specific Options
         
     | 
| 
       259 
259 
     | 
    
         
             
                    provider_type_option_types = nil
         
     | 
| 
         @@ -316,49 +316,49 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       316 
316 
     | 
    
         
             
                        {'fieldName' => 'createBucket', 'fieldLabel' => 'Create Bucket', 'type' => 'checkbox', 'required' => false, 'defaultValue' => false, 'description' => 'Create the bucket if it does not exist.'}
         
     | 
| 
       317 
317 
     | 
    
         
             
                      ]
         
     | 
| 
       318 
318 
     | 
    
         
             
                    else
         
     | 
| 
       319 
     | 
    
         
            -
                      puts "warning: unrecognized storage  
     | 
| 
      
 319 
     | 
    
         
            +
                      puts "warning: unrecognized storage bucket type: '#{storage_provider_type_code}'"
         
     | 
| 
       320 
320 
     | 
    
         
             
                    end
         
     | 
| 
       321 
321 
     | 
    
         
             
                    if provider_type_option_types
         
     | 
| 
       322 
322 
     | 
    
         
             
                      v_prompt = Morpheus::Cli::OptionTypes.prompt(provider_type_option_types, options, @api_client, {})
         
     | 
| 
       323 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 323 
     | 
    
         
            +
                      payload['storageBucket'].deep_merge!(v_prompt)
         
     | 
| 
       324 
324 
     | 
    
         
             
                    end
         
     | 
| 
       325 
325 
     | 
    
         | 
| 
       326 
326 
     | 
    
         
             
                    # Default Backup Target
         
     | 
| 
       327 
327 
     | 
    
         
             
                    if options['defaultBackupTarget'] != nil
         
     | 
| 
       328 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 328 
     | 
    
         
            +
                      payload['storageBucket']['defaultBackupTarget'] = options['defaultBackupTarget']
         
     | 
| 
       329 
329 
     | 
    
         
             
                    else
         
     | 
| 
       330 
330 
     | 
    
         
             
                      v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'defaultBackupTarget', 'fieldLabel' => 'Default Backup Target', 'type' => 'checkbox', 'required' => false, 'description' => '', 'defaultValue' => 'off'}], options)
         
     | 
| 
       331 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 331 
     | 
    
         
            +
                      payload['storageBucket']['defaultBackupTarget'] = (v_prompt['defaultBackupTarget'].to_s == 'on') unless v_prompt['defaultBackupTarget'].nil?
         
     | 
| 
       332 
332 
     | 
    
         
             
                    end
         
     | 
| 
       333 
333 
     | 
    
         | 
| 
       334 
334 
     | 
    
         
             
                    # Archive Snapshots
         
     | 
| 
       335 
335 
     | 
    
         
             
                    if options['copyToStore'] != nil
         
     | 
| 
       336 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 336 
     | 
    
         
            +
                      payload['storageBucket']['copyToStore'] = options['copyToStore']
         
     | 
| 
       337 
337 
     | 
    
         
             
                    else
         
     | 
| 
       338 
338 
     | 
    
         
             
                      v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'copyToStore', 'fieldLabel' => 'Archive Snapshots', 'type' => 'checkbox', 'required' => false, 'description' => '', 'defaultValue' => 'on'}], options)
         
     | 
| 
       339 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 339 
     | 
    
         
            +
                      payload['storageBucket']['copyToStore'] = (v_prompt['copyToStore'].to_s == 'on') unless v_prompt['copyToStore'].nil?
         
     | 
| 
       340 
340 
     | 
    
         
             
                    end
         
     | 
| 
       341 
341 
     | 
    
         | 
| 
       342 
342 
     | 
    
         
             
                    # Default Deployment Target
         
     | 
| 
       343 
343 
     | 
    
         
             
                    if options['defaultDeploymentTarget'] != nil
         
     | 
| 
       344 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 344 
     | 
    
         
            +
                      payload['storageBucket']['defaultDeploymentTarget'] = options['defaultDeploymentTarget']
         
     | 
| 
       345 
345 
     | 
    
         
             
                    else
         
     | 
| 
       346 
346 
     | 
    
         
             
                      v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'defaultDeploymentTarget', 'fieldLabel' => 'Default Deployment Target', 'type' => 'checkbox', 'required' => false, 'description' => '', 'defaultValue' => 'off'}], options)
         
     | 
| 
       347 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 347 
     | 
    
         
            +
                      payload['storageBucket']['defaultDeploymentTarget'] = (v_prompt['defaultDeploymentTarget'].to_s == 'on') unless v_prompt['defaultDeploymentTarget'].nil?
         
     | 
| 
       348 
348 
     | 
    
         
             
                    end
         
     | 
| 
       349 
349 
     | 
    
         | 
| 
       350 
350 
     | 
    
         
             
                    # Default Virtual Image Store
         
     | 
| 
       351 
351 
     | 
    
         
             
                    if options['defaultVirtualImageTarget'] != nil
         
     | 
| 
       352 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 352 
     | 
    
         
            +
                      payload['storageBucket']['defaultVirtualImageTarget'] = options['defaultVirtualImageTarget']
         
     | 
| 
       353 
353 
     | 
    
         
             
                    else
         
     | 
| 
       354 
354 
     | 
    
         
             
                      v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'defaultVirtualImageTarget', 'fieldLabel' => 'Default Virtual Image Store', 'type' => 'checkbox', 'required' => false, 'description' => '', 'defaultValue' => 'off'}], options)
         
     | 
| 
       355 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 355 
     | 
    
         
            +
                      payload['storageBucket']['defaultVirtualImageTarget'] = (v_prompt['defaultVirtualImageTarget'].to_s == 'on') unless v_prompt['defaultVirtualImageTarget'].nil?
         
     | 
| 
       356 
356 
     | 
    
         
             
                    end
         
     | 
| 
       357 
357 
     | 
    
         
             
                    #if create_bucket
         
     | 
| 
       358 
358 
     | 
    
         
             
                    #  payload['createBucket'] = true
         
     | 
| 
       359 
359 
     | 
    
         
             
                    #end
         
     | 
| 
       360 
     | 
    
         
            -
                    if payload[' 
     | 
| 
       361 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 360 
     | 
    
         
            +
                    if payload['storageBucket']['createBucket'] == 'on'
         
     | 
| 
      
 361 
     | 
    
         
            +
                      payload['storageBucket']['createBucket'] = true
         
     | 
| 
       362 
362 
     | 
    
         
             
                    end
         
     | 
| 
       363 
363 
     | 
    
         
             
                  end
         
     | 
| 
       364 
364 
     | 
    
         | 
| 
         @@ -372,8 +372,8 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       372 
372 
     | 
    
         
             
                    print JSON.pretty_generate(json_response)
         
     | 
| 
       373 
373 
     | 
    
         
             
                    print "\n"
         
     | 
| 
       374 
374 
     | 
    
         
             
                  elsif !options[:quiet]
         
     | 
| 
       375 
     | 
    
         
            -
                    storage_provider = json_response[' 
     | 
| 
       376 
     | 
    
         
            -
                    print_green_success "Added storage  
     | 
| 
      
 375 
     | 
    
         
            +
                    storage_provider = json_response['storageBucket']
         
     | 
| 
      
 376 
     | 
    
         
            +
                    print_green_success "Added storage bucket #{storage_provider['name']}"
         
     | 
| 
       377 
377 
     | 
    
         
             
                    get([storage_provider['id']])
         
     | 
| 
       378 
378 
     | 
    
         
             
                  end
         
     | 
| 
       379 
379 
     | 
    
         
             
                  return 0
         
     | 
| 
         @@ -387,11 +387,11 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       387 
387 
     | 
    
         
             
                options = {}
         
     | 
| 
       388 
388 
     | 
    
         
             
                ip_range_list = nil
         
     | 
| 
       389 
389 
     | 
    
         
             
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       390 
     | 
    
         
            -
                  opts.banner = subcommand_usage("[storage- 
     | 
| 
       391 
     | 
    
         
            -
                  opts.on('--name VALUE', String, "Name for this storage  
     | 
| 
      
 390 
     | 
    
         
            +
                  opts.banner = subcommand_usage("[storage-bucket] [options]")
         
     | 
| 
      
 391 
     | 
    
         
            +
                  opts.on('--name VALUE', String, "Name for this storage bucket") do |val|
         
     | 
| 
       392 
392 
     | 
    
         
             
                    options['name'] = val
         
     | 
| 
       393 
393 
     | 
    
         
             
                  end
         
     | 
| 
       394 
     | 
    
         
            -
                  opts.on('--type code', String, "Storage  
     | 
| 
      
 394 
     | 
    
         
            +
                  opts.on('--type code', String, "Storage Bucket Type Code") do |val|
         
     | 
| 
       395 
395 
     | 
    
         
             
                    options['providerType'] = val
         
     | 
| 
       396 
396 
     | 
    
         
             
                  end
         
     | 
| 
       397 
397 
     | 
    
         
             
                  opts.on('--bucket-name VALUE', String, "Bucket Name") do |val|
         
     | 
| 
         @@ -410,8 +410,8 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       410 
410 
     | 
    
         
             
                    options['copyToStore'] = val.to_s == 'on' || val.to_s == 'true'
         
     | 
| 
       411 
411 
     | 
    
         
             
                  end
         
     | 
| 
       412 
412 
     | 
    
         
             
                  build_common_options(opts, options, [:options, :payload, :json, :dry_run, :remote])
         
     | 
| 
       413 
     | 
    
         
            -
                  opts.footer = "Update a storage  
     | 
| 
       414 
     | 
    
         
            -
                                "[storage- 
     | 
| 
      
 413 
     | 
    
         
            +
                  opts.footer = "Update a storage bucket." + "\n" +
         
     | 
| 
      
 414 
     | 
    
         
            +
                                "[storage-bucket] is required. This is the id of a storage bucket."
         
     | 
| 
       415 
415 
     | 
    
         
             
                end
         
     | 
| 
       416 
416 
     | 
    
         
             
                optparse.parse!(args)
         
     | 
| 
       417 
417 
     | 
    
         
             
                if args.count != 1
         
     | 
| 
         @@ -433,44 +433,44 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       433 
433 
     | 
    
         
             
                  if options[:payload]
         
     | 
| 
       434 
434 
     | 
    
         
             
                    payload = options[:payload]
         
     | 
| 
       435 
435 
     | 
    
         
             
                  else
         
     | 
| 
       436 
     | 
    
         
            -
                    # prompt for storage  
     | 
| 
      
 436 
     | 
    
         
            +
                    # prompt for storage bucket options
         
     | 
| 
       437 
437 
     | 
    
         
             
                    # preserve previous config settings
         
     | 
| 
       438 
438 
     | 
    
         
             
                    payload = {
         
     | 
| 
       439 
     | 
    
         
            -
                      ' 
     | 
| 
      
 439 
     | 
    
         
            +
                      'storageBucket' => {
         
     | 
| 
       440 
440 
     | 
    
         
             
                        'config' => storage_provider['config']
         
     | 
| 
       441 
441 
     | 
    
         
             
                      }
         
     | 
| 
       442 
442 
     | 
    
         
             
                    }
         
     | 
| 
       443 
443 
     | 
    
         | 
| 
       444 
444 
     | 
    
         
             
                    # allow arbitrary -O options
         
     | 
| 
       445 
     | 
    
         
            -
                    payload[' 
     | 
| 
      
 445 
     | 
    
         
            +
                    payload['storageBucket'].deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) }) if options[:options]
         
     | 
| 
       446 
446 
     | 
    
         | 
| 
       447 
447 
     | 
    
         
             
                    # Name
         
     | 
| 
       448 
448 
     | 
    
         
             
                    if options['name']
         
     | 
| 
       449 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 449 
     | 
    
         
            +
                      payload['storageBucket']['name'] = options['name']
         
     | 
| 
       450 
450 
     | 
    
         
             
                    end
         
     | 
| 
       451 
451 
     | 
    
         | 
| 
       452 
452 
     | 
    
         
             
                    # Default Backup Target
         
     | 
| 
       453 
453 
     | 
    
         
             
                    if options['defaultBackupTarget'] != nil
         
     | 
| 
       454 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 454 
     | 
    
         
            +
                      payload['storageBucket']['defaultBackupTarget'] = options['defaultBackupTarget']
         
     | 
| 
       455 
455 
     | 
    
         
             
                    end
         
     | 
| 
       456 
456 
     | 
    
         | 
| 
       457 
457 
     | 
    
         
             
                    # Archive Snapshots
         
     | 
| 
       458 
458 
     | 
    
         
             
                    if options['copyToStore'] != nil
         
     | 
| 
       459 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 459 
     | 
    
         
            +
                      payload['storageBucket']['copyToStore'] = options['copyToStore']
         
     | 
| 
       460 
460 
     | 
    
         
             
                    end
         
     | 
| 
       461 
461 
     | 
    
         | 
| 
       462 
462 
     | 
    
         
             
                    # Default Deployment Target
         
     | 
| 
       463 
463 
     | 
    
         
             
                    if options['defaultDeploymentTarget'] != nil
         
     | 
| 
       464 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 464 
     | 
    
         
            +
                      payload['storageBucket']['defaultDeploymentTarget'] = options['defaultDeploymentTarget']
         
     | 
| 
       465 
465 
     | 
    
         
             
                    end
         
     | 
| 
       466 
466 
     | 
    
         | 
| 
       467 
467 
     | 
    
         
             
                    # Default Virtual Image Store
         
     | 
| 
       468 
468 
     | 
    
         
             
                    if options['defaultVirtualImageTarget'] != nil
         
     | 
| 
       469 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 469 
     | 
    
         
            +
                      payload['storageBucket']['defaultVirtualImageTarget'] = options['defaultVirtualImageTarget']
         
     | 
| 
       470 
470 
     | 
    
         
             
                    end
         
     | 
| 
       471 
471 
     | 
    
         | 
| 
       472 
     | 
    
         
            -
                    if payload[' 
     | 
| 
       473 
     | 
    
         
            -
                      payload[' 
     | 
| 
      
 472 
     | 
    
         
            +
                    if payload['storageBucket']['createBucket'] == 'on'
         
     | 
| 
      
 473 
     | 
    
         
            +
                      payload['storageBucket']['createBucket'] = true
         
     | 
| 
       474 
474 
     | 
    
         
             
                    end
         
     | 
| 
       475 
475 
     | 
    
         
             
                  end
         
     | 
| 
       476 
476 
     | 
    
         | 
| 
         @@ -482,8 +482,8 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       482 
482 
     | 
    
         
             
                  if options[:json]
         
     | 
| 
       483 
483 
     | 
    
         
             
                    puts as_json(json_response)
         
     | 
| 
       484 
484 
     | 
    
         
             
                  else
         
     | 
| 
       485 
     | 
    
         
            -
                    storage_provider = json_response[' 
     | 
| 
       486 
     | 
    
         
            -
                    print_green_success "Updated storage  
     | 
| 
      
 485 
     | 
    
         
            +
                    storage_provider = json_response['storageBucket']
         
     | 
| 
      
 486 
     | 
    
         
            +
                    print_green_success "Updated storage bucket #{storage_provider['name']}"
         
     | 
| 
       487 
487 
     | 
    
         
             
                    get([storage_provider['id']])
         
     | 
| 
       488 
488 
     | 
    
         
             
                  end
         
     | 
| 
       489 
489 
     | 
    
         
             
                  return 0
         
     | 
| 
         @@ -496,16 +496,16 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       496 
496 
     | 
    
         
             
              def remove(args)
         
     | 
| 
       497 
497 
     | 
    
         
             
                options = {}
         
     | 
| 
       498 
498 
     | 
    
         
             
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       499 
     | 
    
         
            -
                  opts.banner = subcommand_usage("[storage- 
     | 
| 
      
 499 
     | 
    
         
            +
                  opts.banner = subcommand_usage("[storage-bucket]")
         
     | 
| 
       500 
500 
     | 
    
         
             
                  build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
         
     | 
| 
       501 
     | 
    
         
            -
                  opts.footer = "Delete a storage  
     | 
| 
       502 
     | 
    
         
            -
                                "[storage- 
     | 
| 
      
 501 
     | 
    
         
            +
                  opts.footer = "Delete a storage bucket." + "\n" +
         
     | 
| 
      
 502 
     | 
    
         
            +
                                "[storage-bucket] is required. This is the name or id of a storage bucket."
         
     | 
| 
       503 
503 
     | 
    
         
             
                end
         
     | 
| 
       504 
504 
     | 
    
         
             
                optparse.parse!(args)
         
     | 
| 
       505 
505 
     | 
    
         | 
| 
       506 
506 
     | 
    
         
             
                if args.count < 1
         
     | 
| 
       507 
507 
     | 
    
         
             
                  print_error Morpheus::Terminal.angry_prompt
         
     | 
| 
       508 
     | 
    
         
            -
                  puts_error  "#{command_name} missing argument: [storage- 
     | 
| 
      
 508 
     | 
    
         
            +
                  puts_error  "#{command_name} missing argument: [storage-bucket]\n#{optparse}"
         
     | 
| 
       509 
509 
     | 
    
         
             
                  return 1
         
     | 
| 
       510 
510 
     | 
    
         
             
                end
         
     | 
| 
       511 
511 
     | 
    
         | 
| 
         @@ -514,7 +514,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       514 
514 
     | 
    
         
             
                  storage_provider = find_storage_provider_by_name_or_id(args[0])
         
     | 
| 
       515 
515 
     | 
    
         
             
                  return 1 if storage_provider.nil?
         
     | 
| 
       516 
516 
     | 
    
         | 
| 
       517 
     | 
    
         
            -
                  unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the storage  
     | 
| 
      
 517 
     | 
    
         
            +
                  unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the storage bucket: #{storage_provider['name']}?")
         
     | 
| 
       518 
518 
     | 
    
         
             
                    return 9, "aborted command"
         
     | 
| 
       519 
519 
     | 
    
         
             
                  end
         
     | 
| 
       520 
520 
     | 
    
         
             
                  if options[:dry_run]
         
     | 
| 
         @@ -526,7 +526,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       526 
526 
     | 
    
         
             
                    print JSON.pretty_generate(json_response)
         
     | 
| 
       527 
527 
     | 
    
         
             
                    print "\n"
         
     | 
| 
       528 
528 
     | 
    
         
             
                  else
         
     | 
| 
       529 
     | 
    
         
            -
                    print_green_success "Removed storage  
     | 
| 
      
 529 
     | 
    
         
            +
                    print_green_success "Removed storage bucket #{storage_provider['name']}"
         
     | 
| 
       530 
530 
     | 
    
         
             
                    # list([])
         
     | 
| 
       531 
531 
     | 
    
         
             
                  end
         
     | 
| 
       532 
532 
     | 
    
         
             
                  return 0
         
     | 
| 
         @@ -545,7 +545,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       545 
545 
     | 
    
         
             
                    params[:fullTree] = true
         
     | 
| 
       546 
546 
     | 
    
         
             
                  end
         
     | 
| 
       547 
547 
     | 
    
         
             
                  build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run])
         
     | 
| 
       548 
     | 
    
         
            -
                  opts.footer = "List files in a storage  
     | 
| 
      
 548 
     | 
    
         
            +
                  opts.footer = "List files in a storage bucket. \nInclude [/path] to show files under a directory."
         
     | 
| 
       549 
549 
     | 
    
         
             
                end
         
     | 
| 
       550 
550 
     | 
    
         
             
                optparse.parse!(args)
         
     | 
| 
       551 
551 
     | 
    
         
             
                if args.count < 1 || args.count > 2
         
     | 
| 
         @@ -568,7 +568,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       568 
568 
     | 
    
         
             
                  end
         
     | 
| 
       569 
569 
     | 
    
         
             
                  json_response = @storage_providers_interface.list_files(storage_provider['id'], search_file_path, params)
         
     | 
| 
       570 
570 
     | 
    
         
             
                  storage_files = json_response['storageFiles']
         
     | 
| 
       571 
     | 
    
         
            -
                  # storage_provider = json_response[' 
     | 
| 
      
 571 
     | 
    
         
            +
                  # storage_provider = json_response['storageBucket']
         
     | 
| 
       572 
572 
     | 
    
         
             
                  if options[:json]
         
     | 
| 
       573 
573 
     | 
    
         
             
                    print JSON.pretty_generate(json_response)
         
     | 
| 
       574 
574 
     | 
    
         
             
                    return
         
     | 
| 
         @@ -603,7 +603,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       603 
603 
     | 
    
         
             
                  else
         
     | 
| 
       604 
604 
     | 
    
         
             
                    # puts "No files found for path #{search_file_path}"
         
     | 
| 
       605 
605 
     | 
    
         
             
                    if search_file_path.empty? || search_file_path == "/"
         
     | 
| 
       606 
     | 
    
         
            -
                      puts "This storage  
     | 
| 
      
 606 
     | 
    
         
            +
                      puts "This storage bucket has no files."
         
     | 
| 
       607 
607 
     | 
    
         
             
                      print reset,"\n"
         
     | 
| 
       608 
608 
     | 
    
         
             
                      return 0
         
     | 
| 
       609 
609 
     | 
    
         
             
                    else
         
     | 
| 
         @@ -625,7 +625,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       625 
625 
     | 
    
         
             
                do_long_format = false
         
     | 
| 
       626 
626 
     | 
    
         
             
                do_human_bytes = false
         
     | 
| 
       627 
627 
     | 
    
         
             
                optparse = Morpheus::Cli::OptionParser.new do |opts|
         
     | 
| 
       628 
     | 
    
         
            -
                  opts.banner = subcommand_usage("[ 
     | 
| 
      
 628 
     | 
    
         
            +
                  opts.banner = subcommand_usage("[bucket/path]")
         
     | 
| 
       629 
629 
     | 
    
         
             
                  opts.on('-a', '--all', "Show all files, including subdirectories under the /path.") do
         
     | 
| 
       630 
630 
     | 
    
         
             
                    params[:fullTree] = true
         
     | 
| 
       631 
631 
     | 
    
         
             
                    do_one_file_per_line = true
         
     | 
| 
         @@ -641,7 +641,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       641 
641 
     | 
    
         
             
                    do_one_file_per_line = true
         
     | 
| 
       642 
642 
     | 
    
         
             
                  end
         
     | 
| 
       643 
643 
     | 
    
         
             
                  build_common_options(opts, options, [:list, :json, :fields, :dry_run])
         
     | 
| 
       644 
     | 
    
         
            -
                  opts.footer = "Print filenames for a given location.\nPass storage location in the format  
     | 
| 
      
 644 
     | 
    
         
            +
                  opts.footer = "Print filenames for a given location.\nPass storage location in the format bucket/path."
         
     | 
| 
       645 
645 
     | 
    
         
             
                end
         
     | 
| 
       646 
646 
     | 
    
         
             
                optparse.parse!(args)
         
     | 
| 
       647 
647 
     | 
    
         
             
                if args.count < 1 || args.count > 2
         
     | 
| 
         @@ -671,7 +671,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       671 
671 
     | 
    
         
             
                    end
         
     | 
| 
       672 
672 
     | 
    
         
             
                    return 0
         
     | 
| 
       673 
673 
     | 
    
         
             
                  end
         
     | 
| 
       674 
     | 
    
         
            -
                  #storage_provider = json_response[' 
     | 
| 
      
 674 
     | 
    
         
            +
                  #storage_provider = json_response['storageBucket'] # yep, this is returned too
         
     | 
| 
       675 
675 
     | 
    
         
             
                  storage_files = json_response['storageFiles']
         
     | 
| 
       676 
676 
     | 
    
         
             
                  # print_h2 "Directory: #{search_file_path}"
         
     | 
| 
       677 
677 
     | 
    
         
             
                  # print "Directory: #{search_file_path}"
         
     | 
| 
         @@ -795,7 +795,7 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       795 
795 
     | 
    
         
             
                  opts.on('--ignore-files PATTERN', String, "Pattern of files to be ignored when uploading a directory." ) do |val|
         
     | 
| 
       796 
796 
     | 
    
         
             
                    ignore_regexp = /#{Regexp.escape(val)}/
         
     | 
| 
       797 
797 
     | 
    
         
             
                  end
         
     | 
| 
       798 
     | 
    
         
            -
                  opts.footer = "Upload a local file or folder to a storage  
     | 
| 
      
 798 
     | 
    
         
            +
                  opts.footer = "Upload a local file or folder to a storage bucket. " +
         
     | 
| 
       799 
799 
     | 
    
         
             
                                "\nThe first argument [local-file] should be the path of a local file or directory." +
         
     | 
| 
       800 
800 
     | 
    
         
             
                                "\nThe second argument [provider:/path] should contain the name or id of the provider." +
         
     | 
| 
       801 
801 
     | 
    
         
             
                                "\nThe [:/path] component is optional and can be used to specify the destination of the uploaded file or folder." +
         
     | 
| 
         @@ -1242,10 +1242,10 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       1242 
1242 
     | 
    
         
             
              def find_storage_provider_by_id(id)
         
     | 
| 
       1243 
1243 
     | 
    
         
             
                begin
         
     | 
| 
       1244 
1244 
     | 
    
         
             
                  json_response = @storage_providers_interface.get(id.to_i)
         
     | 
| 
       1245 
     | 
    
         
            -
                  return json_response[' 
     | 
| 
      
 1245 
     | 
    
         
            +
                  return json_response['storageBucket']
         
     | 
| 
       1246 
1246 
     | 
    
         
             
                rescue RestClient::Exception => e
         
     | 
| 
       1247 
1247 
     | 
    
         
             
                  if e.response && e.response.code == 404
         
     | 
| 
       1248 
     | 
    
         
            -
                    print_red_alert "Storage  
     | 
| 
      
 1248 
     | 
    
         
            +
                    print_red_alert "Storage Bucket not found by id #{id}"
         
     | 
| 
       1249 
1249 
     | 
    
         
             
                    return nil
         
     | 
| 
       1250 
1250 
     | 
    
         
             
                  else
         
     | 
| 
       1251 
1251 
     | 
    
         
             
                    raise e
         
     | 
| 
         @@ -1255,12 +1255,12 @@ class Morpheus::Cli::StorageProvidersCommand 
     | 
|
| 
       1255 
1255 
     | 
    
         | 
| 
       1256 
1256 
     | 
    
         
             
              def find_storage_provider_by_name(name)
         
     | 
| 
       1257 
1257 
     | 
    
         
             
                json_response = @storage_providers_interface.list({name: name.to_s})
         
     | 
| 
       1258 
     | 
    
         
            -
                storage_providers = json_response[' 
     | 
| 
      
 1258 
     | 
    
         
            +
                storage_providers = json_response['storageBuckets']
         
     | 
| 
       1259 
1259 
     | 
    
         
             
                if storage_providers.empty?
         
     | 
| 
       1260 
     | 
    
         
            -
                  print_red_alert "Storage  
     | 
| 
      
 1260 
     | 
    
         
            +
                  print_red_alert "Storage Bucket not found by name #{name}"
         
     | 
| 
       1261 
1261 
     | 
    
         
             
                  return nil
         
     | 
| 
       1262 
1262 
     | 
    
         
             
                elsif storage_providers.size > 1
         
     | 
| 
       1263 
     | 
    
         
            -
                  print_red_alert "#{storage_providers.size} storage  
     | 
| 
      
 1263 
     | 
    
         
            +
                  print_red_alert "#{storage_providers.size} storage buckets found by name #{name}"
         
     | 
| 
       1264 
1264 
     | 
    
         
             
                  rows = storage_providers.collect do |storage_provider|
         
     | 
| 
       1265 
1265 
     | 
    
         
             
                    {id: it['id'], name: it['name']}
         
     | 
| 
       1266 
1266 
     | 
    
         
             
                  end
         
     |