Class: Chef::Knife::DigitalOceanDomainDestroy

Inherits:
Chef::Knife
  • Object
show all
Includes:
DigitalOceanBase
Defined in:
lib/chef/knife/digital_ocean_domain_destroy.rb

Instance Method Summary collapse

Methods included from DigitalOceanBase

#client, included, load_deps, #locate_config_value, #validate!, #wait_for_status

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/chef/knife/digital_ocean_domain_destroy.rb', line 28

def run
  $stdout.sync = true

  validate!

  unless locate_config_value(:domain)
    ui.error('Domain cannot be empty. => -D <domain-name>')
    exit 1
  end

  result = client.domains.delete(name: locate_config_value(:domain))
  ui.info 'OK' if result == true || ui.error(JSON.parse(result)['message'])
end