Class: SimpleDeployer::Service

Inherits:
Appoxy::Api::Client
  • Object
show all
Defined in:
lib/simple_deployer/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, options = {}) ⇒ Service

Returns a new instance of Service.



10
11
12
13
14
15
16
# File 'lib/simple_deployer/client.rb', line 10

def initialize(config, options={})
    puts 'Starting SimpleDeployer...'
    self.config = config
    super("http://www.simpledeployer.com/api/", config.access_key, config.secret_key, options)
    self.host = self.config.host if self.config && self.config.host
    self.version = "0.2"
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



7
8
9
# File 'lib/simple_deployer/client.rb', line 7

def config
  @config
end

Instance Method Details

#create_project(name, filename, aws_access_key, aws_secret_key) ⇒ Object



24
25
26
27
# File 'lib/simple_deployer/client.rb', line 24

def create_project(name, filename, aws_access_key, aws_secret_key)
    data = {"name"=>name, "scm_url"=>filename, "aws_access_key"=>aws_access_key, "aws_secret_key"=>aws_secret_key}
    ret = post("projects", data)
end

#databases_list(project_id) ⇒ Object



41
42
43
# File 'lib/simple_deployer/client.rb', line 41

def databases_list(project_id)
    databases = get("projects/#{project_id}/databases")
end

#deploy_code(project_id, params = {}) ⇒ Object



56
57
58
59
60
# File 'lib/simple_deployer/client.rb', line 56

def deploy_code(project_id, params={})
    data = params
    p "DATA is" + data.to_s
    ret = get("projects/#{project_id}/deploy_code", data)
end

#launch_server(project_id) ⇒ Object



30
31
32
33
# File 'lib/simple_deployer/client.rb', line 30

def launch_server(project_id)
    data = {"launch_in_worker"=>"true"}
    ret = get("projects/#{project_id}/launch_server", data)
end

#load_balancer(project_id) ⇒ Object



46
47
48
# File 'lib/simple_deployer/client.rb', line 46

def load_balancer(project_id)
    load_balancer = get("projects/#{project_id}/load_balancer")
end

#project_info(project_id) ⇒ Object



19
20
21
# File 'lib/simple_deployer/client.rb', line 19

def project_info(project_id)
    project = get("project/#{project_id}")
end

#projects_listObject



51
52
53
# File 'lib/simple_deployer/client.rb', line 51

def projects_list()
    projects = get("projects")
end

#reboot_server(server_id) ⇒ Object



68
69
70
# File 'lib/simple_deployer/client.rb', line 68

def reboot_server(server_id)
    get("servers/#{server_id}/reboot")
end

#server_status(server_id) ⇒ Object



63
64
65
# File 'lib/simple_deployer/client.rb', line 63

def server_status(server_id)
    status = get("servers/#{server_id}")
end

#servers_list(project_id) ⇒ Object



36
37
38
# File 'lib/simple_deployer/client.rb', line 36

def servers_list(project_id)
    servers = get("projects/#{project_id}/servers")
end

#terminate_server(server_id) ⇒ Object



73
74
75
# File 'lib/simple_deployer/client.rb', line 73

def terminate_server(server_id)
    delete("servers/#{server_id}")
end