Class: Armrest::CLI::StorageAccount

Inherits:
Armrest::Command show all
Defined in:
lib/armrest/cli/storage_account.rb

Instance Method Summary collapse

Methods inherited from Armrest::Command

alter_command_description, command_help, dispatch, exit_on_failure?, website

Instance Method Details

#check_name_availability(name) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/armrest/cli/storage_account.rb', line 5

def check_name_availability(name)
  result = Armrest::Services::StorageAccount.new(options).check_name_availability(name: name)
  if result.name_available
    puts "Storage account is available: #{name}"
  else
    puts "Storage account is not available: #{name}"
    pp result
  end
end

#create(name) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/armrest/cli/storage_account.rb', line 19

def create(name)
  resp = Armrest::Services::StorageAccount.new(options).create(options.merge(name: name))
  puts "resp:"
  pp resp
  if resp.code == "202"
    puts "Storage account created: #{name}"
  elsif resp.code =~ /^20/
    puts "Storage account updated: #{name}"
  else
    puts "Storage account unable to create: #{name}"
  end
end