Sha256: 23a1feabb5736c40ee53a17aded6df3c0abfddc42870dddef4d406eb5c36b4eb
Contents?: true
Size: 890 Bytes
Versions: 11
Compression:
Stored size: 890 Bytes
Contents
module Kontena module Machine module DigitalOcean class MasterDestroyer include Kontena::Cli::ShellSpinner attr_reader :client, :api_client # @param [String] token Digital Ocean token def initialize(token) @client = DropletKit::Client.new(access_token: token) end def run!(name) droplet = client.droplets.all.find{|d| d.name == name} if droplet spinner "Terminating DigitalOcean droplet #{name.colorize(:cyan)} " do result = client.droplets.delete(id: droplet.id) if result.is_a?(String) abort "Cannot delete droplet #{name.colorize(:cyan)} in DigitalOcean" end end else abort "Cannot find droplet #{name.colorize(:cyan)} in DigitalOcean" end end end end end end
Version data entries
11 entries across 11 versions & 3 rubygems