def remove_machine(opts = {})
      backend_name = opts.fetch(:backend, 'default')
      dryrun       = opts.fetch(:dryrun, false)
      hostname     = opts.fetch(:hostname)
      app_id       = opts.fetch(:app_id)

      if app = Boxcutter::LoadBalancer::Application.find(app_id)

        app.services.each do |service|
          service.each_backend_named(backend_name) do |backend|
            backend.each_machine_named(hostname) do |machine|
              log "Removing #{machine} from #{backend}"

              unless dryrun
                response = machine.remove!
                log "Response was: #{response.body}"
              else
                log "#{hostname} was not removed from the backend because --dryrun was specified"
              end
            end
          end
        end
      else
        log "Could not find application '#{app_id}'"
      end
    end
def remove_machine(opts = {})
      backend_name = opts.fetch(:backend, 'default')
      dryrun       = opts.fetch(:dryrun, false)
      hostname     = opts.fetch(:hostname)
      app_id       = opts.fetch(:app_id)

      if app = Boxcutter::LoadBalancer::Application.find(app_id)

        app.services.each do |service|
          service.each_backend_named(backend_name) do |backend|
            backend.each_machine_named(hostname) do |machine|
              log "Removing #{machine} from #{backend}"

              unless dryrun
                response = machine.remove!
                log "Response was: #{response.body}"
              else
                log "#{hostname} was not removed from the backend because --dryrun was specified"
              end
            end
          end
        end
      else
        log "Could not find application '#{app_id}'"
      end
    end
options:
 - :backend
 - :hostname
 - :dryrun