Class: Chef::Knife::OneandoneBlockStorageCreate
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::OneandoneBlockStorageCreate
- Includes:
- OneandoneBase, Oneandone::Helpers
- Defined in:
- lib/chef/knife/oneandone_block_storage_create.rb
Instance Method Summary collapse
Methods included from Oneandone::Helpers
#split_delimited_input, #validate
Methods included from OneandoneBase
#formated_output, included, #init_client
Instance Method Details
#run ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/chef/knife/oneandone_block_storage_create.rb', line 41 def run $stdout.sync = true validate(config[:name], '-n NAME') validate(config[:size], '-s SIZE') init_client block_storage = OneAndOne::BlockStorage.new response = block_storage.create(name: config[:name], description: config[:description], size: config[:size], datacenter_id: config[:datacenter_id], server_id: config[:server_id]) if config[:wait] block_storage.wait_for formated_output(block_storage.get, true) puts "Block storage #{response['id']} is #{ui.color('created', :bold)}" else formated_output(response, true) puts "Block storage #{response['id']} is #{ui.color('being created', :bold)}" end end |