Class: Services::DatabaseCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/busbar_cli/services/database_creator.rb

Class Method Summary collapse

Class Method Details

.call(name, type, environment) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/busbar_cli/services/database_creator.rb', line 3

def self.call(name, type, environment)
  puts "Creating database #{name} #{type} on environment #{environment}"

  if DatabasesRepository.create(
    id: name,
    type: type,
    namespace: environment
  )
    puts 'Database scheduled for creation'
  else
    puts "There was an issue with the creation of the DB #{name} #{type}" \
          "Make sure that:\n" \
          "- DB name must be unique\n" \
          "- DB name must not contain uppercase characters, dots(.) or underscores(_)\n" \
          '- DB type must be supported'
  end
end