class Services::EnvironmentDestroyer

Public Class Methods

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

Public Instance Methods

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

  EnvironmentsRepository.destroy(environment: @environment)

  puts "Environment #{@environment.app_id} #{@environment.name} is scheduled for destruction"
end

Private Instance Methods

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