Sha256: 5934539212e49bf3577f9777235ccf6340bb38f41176a863c7d25126db2efb7e

Contents?: true

Size: 646 Bytes

Versions: 9

Compression:

Stored size: 646 Bytes

Contents

command :'delete host' do |c|
  c.summary = 'Delete a host in your DigitalOcean account'
  c.syntax = 'ops delete host [DNS_name]'
  c.description = "Delete the host, based on DNS_name, which (not need but) should be described in its #{Ops::HOSTS_DIR}/[DNS_name].yml file  "
  c.example 'Delete the host example.com in your DigitalOcean console', 'ops delete host example.com'
  c.action do |args, options|
    cli = DigitalOcean::client
    id = cli.find_droplet_by_name(args[0]).id
    resp = cli.droplets.delete id: id
    if resp.is_a?(TrueClass)
      say "Droplet #{args[0]} succesfully deleted!"
    else
      raise resp
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
open-dock-0.0.10 lib/open-dock/commands/delete_host.rb
prun-ops-0.0.9 lib/prun-ops/commands/delete_host.rb
prun-ops-0.0.8 lib/prun-ops/commands/delete_host.rb
prun-ops-0.0.7 lib/prun-ops/commands/delete_host.rb
prun-ops-0.0.6 lib/prun-ops/commands/delete_host.rb
prun-ops-0.0.5 lib/prun-ops/commands/delete_host.rb
prun-ops-0.0.4 lib/prun-ops/commands/delete_host.rb
prun-ops-0.0.3 lib/prun-ops/commands/delete_host.rb
prun-ops-0.0.2 lib/prun-ops/commands/delete_host.rb