class Services::DatabaseDestroyer

Public Class Methods

call(database) click to toggle source
# File lib/busbar_cli/services/database_destroyer.rb, line 3
def self.call(database)
  new(database).call
end
new(database) click to toggle source
# File lib/busbar_cli/services/database_destroyer.rb, line 7
def initialize(database)
  @database = database
end

Public Instance Methods

call() click to toggle source
# File lib/busbar_cli/services/database_destroyer.rb, line 11
def call
  confirm

  DatabasesRepository.destroy(database: @database)

  puts "Database #{@database.id} is scheduled for destruction"
end

Private Instance Methods

confirm() click to toggle source
# File lib/busbar_cli/services/database_destroyer.rb, line 21
def confirm
  Confirmator.confirm(
    question: "Are you sure you want to destroy the database #{@database.id} " \
              "on profile #{Services::Kube.current_profile}? " \
              'This action is irreversible.'
  )
end