Class: Cloudscale::Preops::PostgresPreop

Inherits:
PluginPreop show all
Includes:
Singleton
Defined in:
lib/cloudscale/plugins/postgres/preops/postgres_preop.rb

Instance Attribute Summary collapse

Attributes inherited from PluginPreop

#log, #pluginPreops

Attributes inherited from Preop

#log, #registry

Instance Method Summary collapse

Methods inherited from PluginPreop

inherited, pluginPreops

Methods inherited from Preop

#init, #init_charts, #init_menus

Constructor Details

#initializePostgresPreop

Returns a new instance of PostgresPreop.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/cloudscale/plugins/postgres/preops/postgres_preop.rb', line 39

def initialize
  self.init
  @options = {
    :"postgres-host" => {
      :argument => "--postgres-host",
      :description => "Host for your Postgres Instance (e.g. host.instance.com)",
      :required => true,
      :value => nil
    },
    :"postgres-port" => {
      :argument => "--postgres-port",
      :description => "Port for your Postgres Instance (Standard 5432)",
      :required => false,
      :value => 5432
    },
    :"postgres-db" => {
      :argument => "--postgres-db",
      :description => "Database of your Postgres instance",
      :required => true,
      :value => nil
    },
    :"postgres-username" => {
      :argument => "--postgres-username",
      :description => "Username for your Postgres instance",
      :required => false,
      :value => nil
    },
    :"postgres-password" => {
      :argument => "--postgres-password",
      :description => "Password for your Postgres instance",
      :required => false,
      :value => nil
    }
  }
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



20
21
22
# File 'lib/cloudscale/plugins/postgres/preops/postgres_preop.rb', line 20

def connection
  @connection
end

#optionsObject

Returns the value of attribute options.



20
21
22
# File 'lib/cloudscale/plugins/postgres/preops/postgres_preop.rb', line 20

def options
  @options
end

Instance Method Details

#is_enabledObject



22
23
24
25
26
27
28
29
30
# File 'lib/cloudscale/plugins/postgres/preops/postgres_preop.rb', line 22

def is_enabled
  enabled = false

  if !defined? PG
    enabled = false        
  end

  enabled
end

#registerObject



32
33
34
35
36
37
# File 'lib/cloudscale/plugins/postgres/preops/postgres_preop.rb', line 32

def register
  if is_enabled
    init_charts("#{File.dirname(__FILE__)}/../data/postgres_chart.json")
    init_menus("#{File.dirname(__FILE__)}/../data/postgres_menu.json")
  end
end