netscaler-cli 0.1.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ begin
21
21
  Jeweler::Tasks.new do |gem|
22
22
  gem.name = 'netscaler-cli'
23
23
  gem.version = Netscaler::Version.to_s
24
- gem.executables = %W{netscaler-vserver netscaler-service}
24
+ gem.executables = %W{netscaler-vserver netscaler-service netscaler-server}
25
25
  gem.summary = 'Simple command line utilities for interacting remotely with a Netscaler load balancer.'
26
26
  gem.description = 'This gem installs several simple command line utilities locally. It uses the NSConfig.wsdl SOAP interface for remote access.'
27
27
  gem.email = ['madeonamac@gmail.com']
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+
4
+ require 'netscaler/server/cli'
5
+ Netscaler::Server::CLI.new(ARGV).execute!
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.1
@@ -0,0 +1,42 @@
1
+ require 'netscaler/clitemplate'
2
+ require 'netscaler/server/executor'
3
+
4
+ module Netscaler::Server
5
+ class CLI < Netscaler::CLITemplate
6
+ def initialize(args)
7
+ super('server', args)
8
+ end
9
+
10
+ def create_executor(client)
11
+ Netscaler::Server::Executor.new(host, client)
12
+ end
13
+
14
+ def interface_header(opts)
15
+ opts.banner = "Usage: #{File.basename($0)} [OPTIONS] SERVER"
16
+ opts.separator <<DESC
17
+ Description:
18
+ This is a tool for enabling and disabling a server in a Netscaler
19
+ load balancer. The name of the server is required, as is the
20
+ address of the Netscaler load balancer.
21
+
22
+ By default, this script will tell you what its current status of the
23
+ server is.
24
+
25
+ Options:
26
+ DESC
27
+ end
28
+
29
+ def interface_actions(opts)
30
+ opts.separator " Actions: "
31
+ opts.on('-e', '--enable',
32
+ "Enables the given server.") do |e|
33
+ options[:action][:enable] = nil
34
+ end
35
+ opts.on('-d', '--disable',
36
+ "Disables the given server.") do |d|
37
+ options[:action][:disable] = nil
38
+ end
39
+ opts.separator ""
40
+ end
41
+ end # CLI
42
+ end
@@ -0,0 +1,27 @@
1
+ require 'netscaler/baseexecutor'
2
+
3
+ module Netscaler::Server
4
+ class Executor < Netscaler::BaseExecutor
5
+ def initialize(host, client)
6
+ super(host, client)
7
+ @params = { :name => host }
8
+ end
9
+
10
+ def enable
11
+ send_request('enableserver', @params)
12
+ end
13
+
14
+ def disable
15
+ send_request('disableserver', @params)
16
+ end
17
+
18
+ def status
19
+ send_request('getserver', @params) do |response|
20
+ info = response[:return][:list][:item]
21
+ puts "Name: #{info[:name]}"
22
+ puts "IP Address: #{info[:ipaddress]}"
23
+ puts "State: #{info[:state]}"
24
+ end
25
+ end
26
+ end
27
+ end
@@ -15,7 +15,7 @@ module Netscaler::VServer
15
15
  opts.banner = "Usage: #{File.basename($0)} [OPTIONS] VSERVER"
16
16
  opts.separator <<DESC
17
17
  Description:
18
- This is a tool for enabling and disabling virtual server in a Netscaler
18
+ This is a tool for enabling and disabling a virtual server in a Netscaler
19
19
  load balancer. The name of the virtual server is required, as is the
20
20
  address of the Netscaler load balancer.
21
21
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netscaler-cli
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
8
  - 2
10
- version: 0.1.2
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gabe McArthur
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-28 00:00:00 -07:00
18
+ date: 2010-09-30 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -88,6 +88,7 @@ email:
88
88
  executables:
89
89
  - netscaler-vserver
90
90
  - netscaler-service
91
+ - netscaler-server
91
92
  extensions: []
92
93
 
93
94
  extra_rdoc_files:
@@ -95,6 +96,7 @@ extra_rdoc_files:
95
96
  files:
96
97
  - README.markdown
97
98
  - Rakefile
99
+ - bin/netscaler-server
98
100
  - bin/netscaler-service
99
101
  - bin/netscaler-vserver
100
102
  - lib/VERSION
@@ -103,6 +105,8 @@ files:
103
105
  - lib/netscaler/config.rb
104
106
  - lib/netscaler/errors.rb
105
107
  - lib/netscaler/logging.rb
108
+ - lib/netscaler/server/cli.rb
109
+ - lib/netscaler/server/executor.rb
106
110
  - lib/netscaler/service/cli.rb
107
111
  - lib/netscaler/service/executor.rb
108
112
  - lib/netscaler/transaction.rb