Class: CFTools::Tunnel::TunnelNATS
- Inherits:
-
Base
- Object
- CF::CLI
- Base
- CFTools::Tunnel::TunnelNATS
show all
- Defined in:
- lib/tools-cf-plugin/tunnel/tunnel-nats.rb
Constant Summary
Constants inherited
from Base
Base::BOSH_CONFIG
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#authenticate_with_director, #connected_director, #current_deployment, #director, #login_to_director, #precondition, #tunnel_to
Class Method Details
.command_by_name ⇒ Object
10
11
12
13
14
15
|
# File 'lib/tools-cf-plugin/tunnel/tunnel-nats.rb', line 10
def self.command_by_name
proc do |name|
@@commands[name.gsub("-", "_").to_sym] || \
fail("Unknown command '#{name}'.")
end
end
|
Instance Method Details
#tunnel_nats ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/tools-cf-plugin/tunnel/tunnel-nats.rb', line 24
def tunnel_nats
command = input[:command]
director_host = input[:director]
gateway = input[:gateway]
args = input[:args]
director = connected_director(director_host, gateway)
line "Director: #{director.director_uri}"
manifest = current_deployment_manifest(director)
nats = manifest["properties"]["nats"]
nport =
with_progress("Opening local tunnel to NATS") do
tunnel_to(nats["address"], nats["port"], gateway)
end
with_progress("Logging in as admin user") do
login_as_admin(manifest)
end
line "NATS connection: nats://#{nats["user"]}:#{nats["password"]}@127.0.0.1:#{nport}"
execute(
command,
args + %W[
--user #{nats["user"]}
--password #{nats["password"]}
--port #{nport}
],
input.global)
end
|