netscaler 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +20 -19
- data/LICENSE.txt +1 -1
- data/README.md +87 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/netscaler/connection.rb +18 -0
- data/lib/netscaler/cs.rb +17 -0
- data/lib/netscaler/cs/vserver.rb +55 -0
- data/lib/netscaler/cs/vserver/bind.rb +50 -0
- data/lib/netscaler/cs/vserver/unbind.rb +49 -0
- data/lib/netscaler/responder.rb +20 -0
- data/lib/netscaler/responder/action.rb +25 -0
- data/lib/netscaler/responder/policy.rb +25 -0
- data/lib/netscaler/rewrite.rb +20 -0
- data/lib/netscaler/rewrite/action.rb +25 -0
- data/lib/netscaler/rewrite/policy.rb +25 -0
- data/lib/netscaler/service.rb +6 -0
- data/lib/netscaler/servicegroup.rb +1 -1
- data/netscaler.gemspec +18 -5
- data/spec/csvserver_spec.rb +212 -0
- data/spec/lbvserver_spec.rb +1 -1
- data/spec/responder_spec.rb +63 -0
- data/spec/rewrite_spec.rb +63 -0
- metadata +17 -4
- data/README.rdoc +0 -31
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjU2YmQ4NTU0MjdhMzc4ZDljNGNiN2ZlMjIwNGI2ODQ0ZjU1NzNjZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODlmZmMyODA1M2QyYTRmMDc2YjVhYzhkZjdkNTVhZGZmZTZhZTBkMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmE5ODE4NzFiMDU4NDM0NzU4ZmYyMjFmZjc0ZGE4NTNhMzMyYjk4YTM1MzVi
|
10
|
+
OTQwYTU3YjI2ZDYwZjk5NDE0M2ViMDI2OWZjNzA4ZTNiYTAwMGQ2NjZlY2M5
|
11
|
+
YmFmNWM5NDViMDBmYjdjODVjMzY4M2Q4ZDc3YTg3ZjFlYTYxYTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzliMjI5NjY1ZWJiNjQzNmRjNWNhMDEzZmRlZTk2Mjk2MzcxYWZkMTcxNDli
|
14
|
+
MjIzMjcyYTUzNDYxOWZmMDc1YjdlOTY5OGJhZDE4ZTY2ZWU3MjJkNTA3MDRm
|
15
|
+
OWUxZDNlYTlhZjhiZDVlZDg4YTY2YWYzMjBmZWE0NzdlYzE0NmE=
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.3.
|
4
|
+
addressable (2.3.6)
|
5
5
|
builder (3.2.2)
|
6
6
|
diff-lcs (1.1.3)
|
7
|
-
docile (1.1.
|
7
|
+
docile (1.1.5)
|
8
8
|
faraday (0.8.9)
|
9
9
|
multipart-post (~> 1.2.0)
|
10
|
-
git (1.2.
|
10
|
+
git (1.2.8)
|
11
11
|
github_api (0.10.1)
|
12
12
|
addressable
|
13
13
|
faraday (~> 0.8.1)
|
@@ -15,8 +15,8 @@ GEM
|
|
15
15
|
multi_json (~> 1.4)
|
16
16
|
nokogiri (~> 1.5.2)
|
17
17
|
oauth2
|
18
|
-
hashie (
|
19
|
-
highline (1.6.
|
18
|
+
hashie (3.3.2)
|
19
|
+
highline (1.6.21)
|
20
20
|
jeweler (1.8.8)
|
21
21
|
builder
|
22
22
|
bundler (~> 1.0)
|
@@ -26,26 +26,27 @@ GEM
|
|
26
26
|
nokogiri (= 1.5.10)
|
27
27
|
rake
|
28
28
|
rdoc
|
29
|
-
json (1.
|
30
|
-
jwt (
|
31
|
-
|
32
|
-
|
33
|
-
multi_json (1.8.4)
|
29
|
+
json (1.8.1)
|
30
|
+
jwt (1.2.0)
|
31
|
+
mime-types (2.4.3)
|
32
|
+
multi_json (1.10.1)
|
34
33
|
multi_xml (0.5.5)
|
35
34
|
multipart-post (1.2.0)
|
35
|
+
netrc (0.10.2)
|
36
36
|
nokogiri (1.5.10)
|
37
|
-
oauth2 (0.
|
37
|
+
oauth2 (1.0.0)
|
38
38
|
faraday (>= 0.8, < 0.10)
|
39
|
-
jwt (~>
|
39
|
+
jwt (~> 1.0)
|
40
40
|
multi_json (~> 1.3)
|
41
41
|
multi_xml (~> 0.5)
|
42
42
|
rack (~> 1.2)
|
43
|
-
rack (1.
|
44
|
-
rake (10.
|
45
|
-
rdoc (3.12)
|
43
|
+
rack (1.6.0)
|
44
|
+
rake (10.4.2)
|
45
|
+
rdoc (3.12.2)
|
46
46
|
json (~> 1.4)
|
47
|
-
rest-client (1.
|
48
|
-
mime-types (>= 1.16)
|
47
|
+
rest-client (1.7.2)
|
48
|
+
mime-types (>= 1.16, < 3.0)
|
49
|
+
netrc (~> 0.7)
|
49
50
|
rspec (2.8.0)
|
50
51
|
rspec-core (~> 2.8.0)
|
51
52
|
rspec-expectations (~> 2.8.0)
|
@@ -54,9 +55,9 @@ GEM
|
|
54
55
|
rspec-expectations (2.8.0)
|
55
56
|
diff-lcs (~> 1.1.2)
|
56
57
|
rspec-mocks (2.8.0)
|
57
|
-
simplecov (0.
|
58
|
+
simplecov (0.9.1)
|
58
59
|
docile (~> 1.1.0)
|
59
|
-
multi_json
|
60
|
+
multi_json (~> 1.0)
|
60
61
|
simplecov-html (~> 0.8.0)
|
61
62
|
simplecov-html (0.8.0)
|
62
63
|
simplecov-rcov (0.2.3)
|
data/LICENSE.txt
CHANGED
data/README.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/GravityLabs/netscaler.svg?branch=master)](https://travis-ci.org/GravityLabs/netscaler)
|
2
|
+
|
3
|
+
# Netscaler Gem
|
4
|
+
|
5
|
+
A gem that uses the Netscaler [Nitro API][1] to access configs and stats. This has been tested only on Netscaler 9.3. Hoping to have Netscaler 10.0 support added in the near future.
|
6
|
+
|
7
|
+
[1]: http://support.citrix.com/proddocs/topic/netscaler-main-api-10-map/ns-nitro-wrapper-con.html "Nitro API"
|
8
|
+
|
9
|
+
|
10
|
+
# THIS IS PRE-ALPHA!!!
|
11
|
+
|
12
|
+
It is currently *Pre-Alpha* hence the 0-dot version and is susceptible to methods, classes and modules being renamed, added or deleted. I will try my best to back support as much as I can but will provide release notes of changes. Would love to get community support, I have access to a Netscaler and will add this to the spec as well down the road.
|
13
|
+
|
14
|
+
## How it works
|
15
|
+
### Connecting to a Netscaler
|
16
|
+
All params are hash keys. So to create a new connection to a netscaler:
|
17
|
+
```ruby
|
18
|
+
conn = Netscaler::Connection :hostname => 'netscaler01', :username => 'foo', :password => 'bar'
|
19
|
+
```
|
20
|
+
|
21
|
+
If you want to disable ssl verification provide the optional param :verify_ssl => false
|
22
|
+
```ruby
|
23
|
+
conn = Netscaler::Connection :hostname => 'netscaler01', :username => 'foo', :password => 'bar', :verify_ssl => false
|
24
|
+
```
|
25
|
+
|
26
|
+
### Disabling and Enabling a Service
|
27
|
+
We try to keep the classes and methods match the command groups that are in the netscaler cli. So if you are familiar with this then it should be pretty easy to guess what the methods will look like. Such as:
|
28
|
+
|
29
|
+
disable service service01
|
30
|
+
```ruby
|
31
|
+
conn.service.disable(:name => 'service01')
|
32
|
+
```
|
33
|
+
|
34
|
+
enable service service01
|
35
|
+
```ruby
|
36
|
+
conn.service.enable(:name => 'service01')
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
## TODO
|
41
|
+
|
42
|
+
* Classes and methods for Rewrite policies and actions
|
43
|
+
* Classes and methods for Responder policies and actions
|
44
|
+
* Classes and methods for Content Switching policies
|
45
|
+
* Add new definitions for deleting netscaler object entities
|
46
|
+
* Add stats
|
47
|
+
* Add support for Nitro 10.0, 10.1
|
48
|
+
|
49
|
+
## Contributing to Netscaler Gem
|
50
|
+
|
51
|
+
When writing a new class or method we want to try to follow the same names as the command(s) that is in the NSCLI. For instance:
|
52
|
+
|
53
|
+
NSCLI
|
54
|
+
```bash
|
55
|
+
add server <name> (<IPAddress> | (<domain>)
|
56
|
+
```
|
57
|
+
RUBY
|
58
|
+
```ruby
|
59
|
+
conn.server.add :name => 'foo', :domain => '1.1.1.1'
|
60
|
+
```
|
61
|
+
|
62
|
+
Here is another example, adding an lb vserver. We created a sub class of Lb called Netscaler::Lb::Vserver. So it would look something like:
|
63
|
+
|
64
|
+
NSCLI
|
65
|
+
```bash
|
66
|
+
add lb vserver vip1 HTTP 1.1.1.1 80
|
67
|
+
```
|
68
|
+
|
69
|
+
RUBY
|
70
|
+
```ruby
|
71
|
+
conn.lb.vserver.add :name => 'vip1', :serviceType => HTTP, :ipv46 => '1.1.1.1', :port => '80'
|
72
|
+
```
|
73
|
+
|
74
|
+
Otherwise if there are features that are missing or bugs in the code that need fixing, pull requests are welcome. I am mostly using this for disabling and enabling services but new features are welcome so long as they follow this convention to keep consistency.
|
75
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
76
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
77
|
+
* Fork the project.
|
78
|
+
* Start a feature/bugfix branch.
|
79
|
+
* Commit and push until you are happy with your contribution.
|
80
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
81
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
82
|
+
|
83
|
+
## Copyright
|
84
|
+
|
85
|
+
Copyright (c) 2014 Gravity.com, Inc. See LICENSE.txt for
|
86
|
+
further details.
|
87
|
+
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/lib/netscaler/connection.rb
CHANGED
@@ -11,6 +11,9 @@ require 'netscaler/http_adapter'
|
|
11
11
|
require 'netscaler/adapter'
|
12
12
|
require 'netscaler/policy'
|
13
13
|
require 'netscaler/lb'
|
14
|
+
require 'netscaler/cs'
|
15
|
+
require 'netscaler/rewrite'
|
16
|
+
require 'netscaler/responder'
|
14
17
|
|
15
18
|
module Netscaler
|
16
19
|
class Connection
|
@@ -33,6 +36,9 @@ module Netscaler
|
|
33
36
|
@servers = Server.new self
|
34
37
|
@policy = Policy.new self
|
35
38
|
@lb = Lb.new self
|
39
|
+
@cs = Cs.new self
|
40
|
+
@rewrite = Rewrite.new self
|
41
|
+
@responder = Responder.new self
|
36
42
|
end
|
37
43
|
|
38
44
|
def adapter
|
@@ -67,6 +73,18 @@ module Netscaler
|
|
67
73
|
@lb
|
68
74
|
end
|
69
75
|
|
76
|
+
def cs
|
77
|
+
@cs
|
78
|
+
end
|
79
|
+
|
80
|
+
def rewrite
|
81
|
+
@rewrite
|
82
|
+
end
|
83
|
+
|
84
|
+
def responder
|
85
|
+
@responder
|
86
|
+
end
|
87
|
+
|
70
88
|
def servers
|
71
89
|
return @servers
|
72
90
|
end
|
data/lib/netscaler/cs.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'netscaler/cs/vserver'
|
2
|
+
require 'netscaler/cs/vserver/bind'
|
3
|
+
require 'netscaler/cs/vserver/unbind'
|
4
|
+
|
5
|
+
module Netscaler
|
6
|
+
class Cs
|
7
|
+
|
8
|
+
def initialize(netscaler)
|
9
|
+
@netscaler = netscaler
|
10
|
+
end
|
11
|
+
|
12
|
+
def vserver
|
13
|
+
Vserver.new @netscaler
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'netscaler/netscaler_service'
|
2
|
+
|
3
|
+
module Netscaler
|
4
|
+
class Cs
|
5
|
+
class Vserver < NetscalerService
|
6
|
+
def initialize(netscaler)
|
7
|
+
@netscaler=netscaler
|
8
|
+
end
|
9
|
+
|
10
|
+
def show(payload={})
|
11
|
+
if payload[:name] != nil then
|
12
|
+
validate_payload(payload, [:name])
|
13
|
+
return @netscaler.adapter.get("config/csvserver/#{payload[:name]}")
|
14
|
+
elsif payload == {} then
|
15
|
+
return @netscaler.adapter.get('config/csvserver/')
|
16
|
+
else
|
17
|
+
raise ArgumentError, 'payload supplied must have been missing :name'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def show_binding(payload)
|
22
|
+
raise ArgumentError, 'payload cannot be null' if payload.nil?
|
23
|
+
validate_payload(payload, [:name])
|
24
|
+
return @netscaler.adapter.get("config/csvserver_binding/#{payload[:name]}")
|
25
|
+
end
|
26
|
+
|
27
|
+
def remove(payload) # :args: :name
|
28
|
+
raise ArgumentError, 'payload cannot be null' if payload.nil?
|
29
|
+
validate_payload(payload, [:name])
|
30
|
+
return @netscaler.adapter.delete("config/csvserver/#{payload[:name]}")
|
31
|
+
end
|
32
|
+
|
33
|
+
def add(payload)
|
34
|
+
raise ArgumentError, 'payload cannot be null' if payload.nil?
|
35
|
+
validate_payload(payload, [:name, :serviceType, :ipv46, :port])
|
36
|
+
return @netscaler.adapter.post_no_body('config/csvserver/', {'csvserver' => payload})
|
37
|
+
end
|
38
|
+
|
39
|
+
def stat(payload)
|
40
|
+
raise ArgumentError, 'payload cannot be null' if payload.nil?
|
41
|
+
validate_payload(payload, [:name])
|
42
|
+
return @netscaler.adapter.get("stat/csvserver/#{payload[:name]}")
|
43
|
+
end
|
44
|
+
|
45
|
+
def bind
|
46
|
+
Bind.new @netscaler
|
47
|
+
end
|
48
|
+
|
49
|
+
def unbind
|
50
|
+
Unbind.new @netscaler
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Netscaler
|
2
|
+
class Cs
|
3
|
+
class Vserver
|
4
|
+
class Bind < NetscalerService
|
5
|
+
def initialize(netscaler)
|
6
|
+
@netscaler=netscaler
|
7
|
+
end
|
8
|
+
|
9
|
+
=begin
|
10
|
+
|
11
|
+
object=
|
12
|
+
{
|
13
|
+
'params': {'action':'bind'},
|
14
|
+
"csvserver_cspolicy_binding":
|
15
|
+
{
|
16
|
+
"name":"cs_test_80",
|
17
|
+
"targetvserver":"lb_thumby_80",
|
18
|
+
"policyname": "cs_test_rule",
|
19
|
+
"priority": "800",
|
20
|
+
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
=end
|
25
|
+
def cs_policy(payload)
|
26
|
+
raise ArgumentError, 'payload cannot be null' if payload.nil?
|
27
|
+
validate_payload(payload, [:name, :targetvserver])
|
28
|
+
# Need to find a way to throw optional args as well, including :policyname and :priority
|
29
|
+
return @netscaler.adapter.post_no_body("config/csvserver_cspolicy_binding/#{payload['name']}", {'params' => {'action' => 'bind'}, 'csvserver_cspolicy_binding' => payload})
|
30
|
+
end
|
31
|
+
|
32
|
+
def rewrite_policy(payload)
|
33
|
+
raise ArgumentError, 'payload cannot be null' if payload.nil?
|
34
|
+
validate_payload(payload, [:name, :policyName, :priority, :bindpoint])
|
35
|
+
return @netscaler.adapter.post_no_body("config/csvserver_rewritepolicy_binding/#{payload['name']}", {'params' => {'action' => 'bind'}, 'csvserver_rewritepolicy_binding' => payload})
|
36
|
+
end
|
37
|
+
|
38
|
+
def responder_policy(payload)
|
39
|
+
raise ArgumentError, 'payload cannot be null' if payload.nil?
|
40
|
+
validate_payload(payload, [:name, :policyName, :priority])
|
41
|
+
return @netscaler.adapter.post_no_body("config/csvserver_responderpolicy_binding/#{payload['name']}", {'params' => {'action' => 'bind'}, 'csvserver_responderpolicy_binding' => payload})
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Netscaler
|
2
|
+
class Cs
|
3
|
+
class Vserver
|
4
|
+
class Unbind < NetscalerService
|
5
|
+
def initialize(netscaler)
|
6
|
+
@netscaler=netscaler
|
7
|
+
end
|
8
|
+
|
9
|
+
=begin
|
10
|
+
|
11
|
+
object=
|
12
|
+
{
|
13
|
+
'params': {'action':'bind'},
|
14
|
+
"csvserver_cspolicy_binding":
|
15
|
+
{
|
16
|
+
"name":"cs_test_80",
|
17
|
+
"targetvserver":"lb_thumby_80",
|
18
|
+
"policyname": "cs_test_rule",
|
19
|
+
"priority": "800",
|
20
|
+
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
=end
|
25
|
+
def cs_policy(payload)
|
26
|
+
raise ArgumentError, 'payload cannot be null' if payload.nil?
|
27
|
+
validate_payload(payload, [:name])
|
28
|
+
# Need to find a way to throw optional args as well, including :policyname and :priority
|
29
|
+
return @netscaler.adapter.post_no_body("config/csvserver_cspolicy_binding/#{payload['name']}?action=unbind/", {'params' => {'action' => 'unbind'}, 'csvserver_cspolicy_binding' => payload})
|
30
|
+
end
|
31
|
+
|
32
|
+
# Creates new methods that share the same args but have slightly different endpoints
|
33
|
+
%w( rewrite responder).each do |type|
|
34
|
+
|
35
|
+
define_method(type + '_policy') do |payload|
|
36
|
+
raise ArgumentError, 'payload cannot be null' if payload.nil?
|
37
|
+
validate_payload(payload, [:name, :policyName])
|
38
|
+
return @netscaler.adapter.post_no_body("config/csvserver_#{type}policy_binding/#{payload['name']}?action=unbind/", {'params' => {'action' => 'unbind'}, "lbvserver_#{type}policy_binding" => payload})
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'netscaler/responder/action'
|
2
|
+
require 'netscaler/responder/policy'
|
3
|
+
|
4
|
+
module Netscaler
|
5
|
+
class Responder
|
6
|
+
|
7
|
+
def initialize(netscaler)
|
8
|
+
@netscaler = netscaler
|
9
|
+
end
|
10
|
+
|
11
|
+
def action
|
12
|
+
Action.new @netscaler
|
13
|
+
end
|
14
|
+
|
15
|
+
def policy
|
16
|
+
Policy.new @netscaler
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'netscaler/netscaler_service'
|
2
|
+
|
3
|
+
module Netscaler
|
4
|
+
class Responder
|
5
|
+
class Action < NetscalerService
|
6
|
+
|
7
|
+
def initialize(netscaler)
|
8
|
+
@netscaler=netscaler
|
9
|
+
end
|
10
|
+
|
11
|
+
def show(payload={})
|
12
|
+
if payload[:name] != nil then
|
13
|
+
validate_payload(payload, [:name])
|
14
|
+
return @netscaler.adapter.get("config/responderaction/#{payload[:name]}")
|
15
|
+
elsif payload == {} then
|
16
|
+
return @netscaler.adapter.get('config/responderaction/')
|
17
|
+
else
|
18
|
+
raise ArgumentError, 'payload supplied must have been missing :name'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'netscaler/netscaler_service'
|
2
|
+
|
3
|
+
module Netscaler
|
4
|
+
class Responder
|
5
|
+
class Policy < NetscalerService
|
6
|
+
|
7
|
+
def initialize(netscaler)
|
8
|
+
@netscaler=netscaler
|
9
|
+
end
|
10
|
+
|
11
|
+
def show(payload={})
|
12
|
+
if payload[:name] != nil then
|
13
|
+
validate_payload(payload, [:name])
|
14
|
+
return @netscaler.adapter.get("config/responderpolicy/#{payload[:name]}")
|
15
|
+
elsif payload == {} then
|
16
|
+
return @netscaler.adapter.get('config/responderpolicy/')
|
17
|
+
else
|
18
|
+
raise ArgumentError, 'payload supplied must have been missing :name'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'netscaler/rewrite/action'
|
2
|
+
require 'netscaler/rewrite/policy'
|
3
|
+
|
4
|
+
module Netscaler
|
5
|
+
class Rewrite
|
6
|
+
|
7
|
+
def initialize(netscaler)
|
8
|
+
@netscaler = netscaler
|
9
|
+
end
|
10
|
+
|
11
|
+
def action
|
12
|
+
Action.new @netscaler
|
13
|
+
end
|
14
|
+
|
15
|
+
def policy
|
16
|
+
Policy.new @netscaler
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'netscaler/netscaler_service'
|
2
|
+
|
3
|
+
module Netscaler
|
4
|
+
class Rewrite
|
5
|
+
class Action < NetscalerService
|
6
|
+
|
7
|
+
def initialize(netscaler)
|
8
|
+
@netscaler=netscaler
|
9
|
+
end
|
10
|
+
|
11
|
+
def show(payload={})
|
12
|
+
if payload[:name] != nil then
|
13
|
+
validate_payload(payload, [:name])
|
14
|
+
return @netscaler.adapter.get("config/rewriteaction/#{payload[:name]}")
|
15
|
+
elsif payload == {} then
|
16
|
+
return @netscaler.adapter.get('config/rewriteaction/')
|
17
|
+
else
|
18
|
+
raise ArgumentError, 'payload supplied must have been missing :name'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'netscaler/netscaler_service'
|
2
|
+
|
3
|
+
module Netscaler
|
4
|
+
class Rewrite
|
5
|
+
class Policy < NetscalerService
|
6
|
+
|
7
|
+
def initialize(netscaler)
|
8
|
+
@netscaler=netscaler
|
9
|
+
end
|
10
|
+
|
11
|
+
def show(payload={})
|
12
|
+
if payload[:name] != nil then
|
13
|
+
validate_payload(payload, [:name])
|
14
|
+
return @netscaler.adapter.get("config/rewritepolicy/#{payload[:name]}")
|
15
|
+
elsif payload == {} then
|
16
|
+
return @netscaler.adapter.get('config/rewritepolicy/')
|
17
|
+
else
|
18
|
+
raise ArgumentError, 'payload supplied must have been missing :name'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
data/lib/netscaler/service.rb
CHANGED
@@ -18,6 +18,12 @@ module Netscaler
|
|
18
18
|
return @netscaler.adapter.post_no_body('config/service/', {'service' => payload})
|
19
19
|
end
|
20
20
|
|
21
|
+
def remove(payload) # :args: :server
|
22
|
+
raise ArgumentError, 'payload cannot be null' if payload.nil?
|
23
|
+
validate_payload(payload, [:name])
|
24
|
+
return @netscaler.adapter.delete("config/service/#{payload[:name]}")
|
25
|
+
end
|
26
|
+
|
21
27
|
##
|
22
28
|
# :serverName is optional, if omitted it will return all services
|
23
29
|
# configured on the Netscaler.
|
@@ -21,7 +21,7 @@ module Netscaler
|
|
21
21
|
##
|
22
22
|
# argument is optional, if left empty it will return all servicegroups
|
23
23
|
def show(payload={}) # :arg: servicegroupname
|
24
|
-
return @netscaler.adapter.get("config/servicegroup/") if payload
|
24
|
+
return @netscaler.adapter.get("config/servicegroup/") if payload.empty?
|
25
25
|
return @netscaler.adapter.get("config/servicegroup/#{payload}")
|
26
26
|
end
|
27
27
|
|
data/netscaler.gemspec
CHANGED
@@ -2,21 +2,21 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: netscaler 0.
|
5
|
+
# stub: netscaler 0.5.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "netscaler"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.5.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Jeremy Custenborder", "David Andrew", "Jarrett Irons"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2015-01-19"
|
15
15
|
s.description = "Netscaler api working against the Citrix Nitro api. Currently supports Nitro 9.3. Hope to add support for 10.X. Currently has support for som basics such as adding servers/services/servicegroups."
|
16
16
|
s.email = ["jeremy@scarcemedia.com", "david.andrew@webtrends.com", "jarrett.irons@gmail.com"]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
19
|
-
"README.
|
19
|
+
"README.md"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
@@ -24,12 +24,16 @@ Gem::Specification.new do |s|
|
|
24
24
|
"Gemfile",
|
25
25
|
"Gemfile.lock",
|
26
26
|
"LICENSE.txt",
|
27
|
-
"README.
|
27
|
+
"README.md",
|
28
28
|
"Rakefile",
|
29
29
|
"VERSION",
|
30
30
|
"lib/netscaler.rb",
|
31
31
|
"lib/netscaler/adapter.rb",
|
32
32
|
"lib/netscaler/connection.rb",
|
33
|
+
"lib/netscaler/cs.rb",
|
34
|
+
"lib/netscaler/cs/vserver.rb",
|
35
|
+
"lib/netscaler/cs/vserver/bind.rb",
|
36
|
+
"lib/netscaler/cs/vserver/unbind.rb",
|
33
37
|
"lib/netscaler/http_adapter.rb",
|
34
38
|
"lib/netscaler/lb.rb",
|
35
39
|
"lib/netscaler/lb/monitor.rb",
|
@@ -42,13 +46,22 @@ Gem::Specification.new do |s|
|
|
42
46
|
"lib/netscaler/netscaler_service.rb",
|
43
47
|
"lib/netscaler/policy.rb",
|
44
48
|
"lib/netscaler/policy/stringmap.rb",
|
49
|
+
"lib/netscaler/responder.rb",
|
50
|
+
"lib/netscaler/responder/action.rb",
|
51
|
+
"lib/netscaler/responder/policy.rb",
|
52
|
+
"lib/netscaler/rewrite.rb",
|
53
|
+
"lib/netscaler/rewrite/action.rb",
|
54
|
+
"lib/netscaler/rewrite/policy.rb",
|
45
55
|
"lib/netscaler/server.rb",
|
46
56
|
"lib/netscaler/service.rb",
|
47
57
|
"lib/netscaler/servicegroup.rb",
|
48
58
|
"netscaler.gemspec",
|
59
|
+
"spec/csvserver_spec.rb",
|
49
60
|
"spec/lbvserver_spec.rb",
|
50
61
|
"spec/netscaler_spec.rb",
|
51
62
|
"spec/policy_stringmap_spec.rb",
|
63
|
+
"spec/responder_spec.rb",
|
64
|
+
"spec/rewrite_spec.rb",
|
52
65
|
"spec/server_spec.rb",
|
53
66
|
"spec/service_spec.rb",
|
54
67
|
"spec/servicegroup_spec.rb",
|
@@ -0,0 +1,212 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'netscaler'
|
3
|
+
require 'netscaler/mock_adapter'
|
4
|
+
|
5
|
+
describe Netscaler::Cs::Vserver do
|
6
|
+
|
7
|
+
connection = Netscaler::Connection.new 'hostname' => 'foo', 'password' => 'bar', 'username' => 'bar'
|
8
|
+
connection.adapter = Netscaler::MockAdapter.new :body => '{ "errorcode": 0, "message": "Done" }'
|
9
|
+
|
10
|
+
context 'when adding a new csvserver' do
|
11
|
+
it 'a name is required' do
|
12
|
+
expect {
|
13
|
+
connection.cs.vserver.add(:serviceType => 'HTTP', :port => '80', :ipv46 => '1.1.1.1')
|
14
|
+
}.should raise_error(ArgumentError, /name/)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'a service type is required' do
|
18
|
+
expect {
|
19
|
+
connection.cs.vserver.add(:name => 'foo', :port => '80', :ipv46 => '1.1.1.1')
|
20
|
+
}.should raise_error(ArgumentError, /serviceType/)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'a port is required' do
|
24
|
+
expect {
|
25
|
+
connection.cs.vserver.add(:name => 'foo', :serviceType => 'HTTP', :ipv46 => '1.1.1.1')
|
26
|
+
}.should raise_error(ArgumentError, /port/)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'a ipv46 is required' do
|
30
|
+
expect {
|
31
|
+
connection.cs.vserver.add(:name => 'foo', :serviceType => 'HTTP', :port => '80')
|
32
|
+
}.should raise_error(ArgumentError, /ipv46/)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'return hash when supplied all required params' do
|
36
|
+
result = connection.cs.vserver.add(:name => 'foo', :serviceType => 'HTTP', :port => '80', :ipv46 => '1.1.1.1')
|
37
|
+
result.should be_kind_of(Hash)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'when using the show method in Cs::Vserver' do
|
42
|
+
it 'with no param used it will return all vservers' do
|
43
|
+
result = connection.cs.vserver.show
|
44
|
+
result.should be_kind_of(Hash)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'supplying the name parameter will return Hash' do
|
48
|
+
result = connection.cs.vserver.show :name => 'foo'
|
49
|
+
result.should be_kind_of(Hash)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'when showing a particular lb vserver string is invalid' do
|
53
|
+
expect {
|
54
|
+
connection.cs.vserver.show('asdf')
|
55
|
+
}.should raise_error(TypeError, /conver(t|sion)/)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'when showing a particular lb vserver :name is required' do
|
59
|
+
expect {
|
60
|
+
connection.cs.vserver.show(:foo => 'bar')
|
61
|
+
}.should raise_error(ArgumentError, /name/)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'when removing an lb vserver' do
|
66
|
+
it 'a name is required' do
|
67
|
+
expect {
|
68
|
+
connection.cs.vserver.remove()
|
69
|
+
}.should raise_error(ArgumentError, /wrong number/)
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'throw an arg error if :name arg is missing' do
|
73
|
+
expect {
|
74
|
+
connection.cs.vserver.remove(:foo => 'bar')
|
75
|
+
}.should raise_error(ArgumentError, /name/)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should return a hash if :name is supplied' do
|
79
|
+
result = connection.cs.vserver.remove :name => 'foo'
|
80
|
+
result.should be_kind_of(Hash)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context 'when showing csvserver bindings' do
|
85
|
+
it 'should throw an error if there is no arg' do
|
86
|
+
expect {
|
87
|
+
connection.cs.vserver.show_binding()
|
88
|
+
}.should raise_error(ArgumentError, /wrong number/)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'throw an arg error if :name arg is missing' do
|
92
|
+
expect {
|
93
|
+
connection.cs.vserver.show_binding(:foo => 'bar')
|
94
|
+
}.should raise_error(ArgumentError, /name/)
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'should return a hash if :name is supplied' do
|
98
|
+
result = connection.cs.vserver.show_binding :name => 'foo'
|
99
|
+
result.should be_kind_of(Hash)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'when [un]binding lb vservers to cs vserver' do
|
104
|
+
it 'should throw an error if :name arg is not given' do
|
105
|
+
expect {
|
106
|
+
connection.cs.vserver.bind.cs_policy :serviceName => 'foo'
|
107
|
+
}.should raise_error(ArgumentError, /name/)
|
108
|
+
expect {
|
109
|
+
connection.cs.vserver.unbind.cs_policy :serviceName => 'foo'
|
110
|
+
}.should raise_error(ArgumentError, /name/)
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should throw an error if :targetvserver arg is not given' do
|
114
|
+
expect {
|
115
|
+
connection.cs.vserver.bind.cs_policy :name => 'foo'
|
116
|
+
}.should raise_error(ArgumentError, /targetvserver/)
|
117
|
+
|
118
|
+
#This is actually not expected when unbinding.
|
119
|
+
# expect {
|
120
|
+
# connection.cs.vserver.unbind.cs_policy :name => 'foo'
|
121
|
+
# }.should raise_error(ArgumentError, /targetvserver/)
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'should return a Hash if all require arguments are supplied' do
|
126
|
+
result = connection.cs.vserver.bind.cs_policy :name => 'foo', :targetvserver => 'bar'
|
127
|
+
result.should be_kind_of(Hash)
|
128
|
+
unbind_result = connection.cs.vserver.unbind.cs_policy :name => 'foo'
|
129
|
+
unbind_result.should be_kind_of(Hash)
|
130
|
+
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
context 'when [un]binding rewritepolicies to cs vserver' do
|
135
|
+
it 'should throw an error if :name arg is not given' do
|
136
|
+
expect {
|
137
|
+
connection.cs.vserver.bind.rewrite_policy :policyName => 'bar', :priority => '10', :bindpoint => 'request'
|
138
|
+
}.should raise_error(ArgumentError, /name/)
|
139
|
+
|
140
|
+
expect {
|
141
|
+
connection.cs.vserver.unbind.rewrite_policy :policyName => 'bar', :priority => '10', :bindpoint => 'request'
|
142
|
+
}.should raise_error(ArgumentError, /name/)
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'should throw an error if :policyName arg is not given' do
|
147
|
+
expect {
|
148
|
+
connection.cs.vserver.bind.rewrite_policy :name => 'foo', :priority => '10', :bindpoint => 'request'
|
149
|
+
}.should raise_error(ArgumentError, /policyName/)
|
150
|
+
|
151
|
+
expect {
|
152
|
+
connection.cs.vserver.unbind.rewrite_policy :name => 'foo', :priority => '10', :bindpoint => 'request'
|
153
|
+
}.should raise_error(ArgumentError, /policyName/)
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'should throw an error if :priority arg is not given' do
|
157
|
+
expect {
|
158
|
+
connection.cs.vserver.bind.rewrite_policy :name => 'foo', :policyName => 'bar', :bindpoint => 'request'
|
159
|
+
}.should raise_error(ArgumentError, /priority/)
|
160
|
+
end
|
161
|
+
|
162
|
+
it 'should throw an error if :bindpoint arg is not given' do
|
163
|
+
expect {
|
164
|
+
connection.cs.vserver.bind.rewrite_policy :name => 'foo', :policyName => 'bar', :priority => '10'
|
165
|
+
}.should raise_error(ArgumentError, /bindpoint/)
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'should return a Hash if all require arguments are supplied' do
|
169
|
+
result = connection.cs.vserver.bind.rewrite_policy :name => 'foo', :policyName => 'bar', :priority => '10', :bindpoint => 'request'
|
170
|
+
result.should be_kind_of(Hash)
|
171
|
+
unbind_result = connection.cs.vserver.unbind.rewrite_policy :name => 'foo', :policyName => 'bar'
|
172
|
+
unbind_result.should be_kind_of(Hash)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
context 'when [un]binding responderpolicies to cs vserver' do
|
177
|
+
it 'should throw an error if :name arg is not given' do
|
178
|
+
expect {
|
179
|
+
connection.cs.vserver.bind.responder_policy :policyName => 'bar', :priority => '10'
|
180
|
+
}.should raise_error(ArgumentError, /name/)
|
181
|
+
|
182
|
+
expect {
|
183
|
+
connection.cs.vserver.unbind.responder_policy :policyName => 'bar', :priority => '10'
|
184
|
+
}.should raise_error(ArgumentError, /name/)
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'should throw an error if :policyName arg is not given' do
|
189
|
+
expect {
|
190
|
+
connection.cs.vserver.bind.responder_policy :name => 'foo', :priority => '10'
|
191
|
+
}.should raise_error(ArgumentError, /policyName/)
|
192
|
+
|
193
|
+
expect {
|
194
|
+
connection.cs.vserver.unbind.responder_policy :name => 'foo', :priority => '10'
|
195
|
+
}.should raise_error(ArgumentError, /policyName/)
|
196
|
+
end
|
197
|
+
|
198
|
+
it 'should throw an error if :priority arg is not given' do
|
199
|
+
expect {
|
200
|
+
connection.cs.vserver.bind.responder_policy :name => 'foo', :policyName => 'bar'
|
201
|
+
}.should raise_error(ArgumentError, /priority/)
|
202
|
+
end
|
203
|
+
|
204
|
+
it 'should return a Hash if all require arguments are supplied' do
|
205
|
+
result = connection.cs.vserver.bind.responder_policy :name => 'foo', :policyName => 'bar', :priority => '10', :bindpoint => 'request'
|
206
|
+
result.should be_kind_of(Hash)
|
207
|
+
unbind_result = connection.cs.vserver.unbind.responder_policy :name => 'foo', :policyName => 'bar'
|
208
|
+
unbind_result.should be_kind_of(Hash)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
data/spec/lbvserver_spec.rb
CHANGED
@@ -52,7 +52,7 @@ describe Netscaler::Lb::Vserver do
|
|
52
52
|
it 'when showing a particular lb vserver string is invalid' do
|
53
53
|
expect {
|
54
54
|
connection.lb.vserver.show('asdf')
|
55
|
-
}.should raise_error(TypeError, /
|
55
|
+
}.should raise_error(TypeError, /conver(t|sion)/)
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'when showing a particular lb vserver :name is required' do
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'netscaler'
|
3
|
+
require 'netscaler/mock_adapter'
|
4
|
+
|
5
|
+
describe Netscaler::Responder::Action do
|
6
|
+
|
7
|
+
connection = Netscaler::Connection.new 'hostname' => 'foo', 'password' => 'bar', 'username' => 'bar'
|
8
|
+
connection.adapter = Netscaler::MockAdapter.new :body => '{ "errorcode": 0, "message": "Done" }'
|
9
|
+
|
10
|
+
context 'when using the show method in Responder::Action' do
|
11
|
+
it 'with no param used it will return all responder actions' do
|
12
|
+
result = connection.responder.action.show
|
13
|
+
result.should be_kind_of(Hash)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'supplying the name parameter will return Hash' do
|
17
|
+
result = connection.responder.action.show :name => 'foo'
|
18
|
+
result.should be_kind_of(Hash)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'when showing a particular responder action, string is invalid' do
|
22
|
+
expect {
|
23
|
+
connection.responder.action.show('asdf')
|
24
|
+
}.should raise_error(TypeError, /conver(t|sion)/)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'when showing a particular responder action :name is required' do
|
28
|
+
expect {
|
29
|
+
connection.responder.action.show(:foo => 'bar')
|
30
|
+
}.should raise_error(ArgumentError, /name/)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe Netscaler::Responder::Policy do
|
36
|
+
|
37
|
+
connection = Netscaler::Connection.new 'hostname' => 'foo', 'password' => 'bar', 'username' => 'bar'
|
38
|
+
connection.adapter = Netscaler::MockAdapter.new :body => '{ "errorcode": 0, "message": "Done" }'
|
39
|
+
|
40
|
+
context 'when using the show method in Responder::Policy' do
|
41
|
+
it 'with no param used it will return all responder policies' do
|
42
|
+
result = connection.responder.policy.show
|
43
|
+
result.should be_kind_of(Hash)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'supplying the name parameter will return Hash' do
|
47
|
+
result = connection.responder.policy.show :name => 'foo'
|
48
|
+
result.should be_kind_of(Hash)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'when showing a particular responder policy, string is invalid' do
|
52
|
+
expect {
|
53
|
+
connection.responder.policy.show('asdf')
|
54
|
+
}.should raise_error(TypeError, /conver(t|sion)/)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'when showing a particular responder policy :name is required' do
|
58
|
+
expect {
|
59
|
+
connection.responder.policy.show(:foo => 'bar')
|
60
|
+
}.should raise_error(ArgumentError, /name/)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'netscaler'
|
3
|
+
require 'netscaler/mock_adapter'
|
4
|
+
|
5
|
+
describe Netscaler::Rewrite::Action do
|
6
|
+
|
7
|
+
connection = Netscaler::Connection.new 'hostname' => 'foo', 'password' => 'bar', 'username' => 'bar'
|
8
|
+
connection.adapter = Netscaler::MockAdapter.new :body => '{ "errorcode": 0, "message": "Done" }'
|
9
|
+
|
10
|
+
context 'when using the show method in Rewrite::Action' do
|
11
|
+
it 'with no param used it will return all rewrite actions' do
|
12
|
+
result = connection.rewrite.action.show
|
13
|
+
result.should be_kind_of(Hash)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'supplying the name parameter will return Hash' do
|
17
|
+
result = connection.rewrite.action.show :name => 'foo'
|
18
|
+
result.should be_kind_of(Hash)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'when showing a particular rewrite action, string is invalid' do
|
22
|
+
expect {
|
23
|
+
connection.rewrite.action.show('asdf')
|
24
|
+
}.should raise_error(TypeError, /conver(t|sion)/)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'when showing a particular rewrite action :name is required' do
|
28
|
+
expect {
|
29
|
+
connection.rewrite.action.show(:foo => 'bar')
|
30
|
+
}.should raise_error(ArgumentError, /name/)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe Netscaler::Rewrite::Policy do
|
36
|
+
|
37
|
+
connection = Netscaler::Connection.new 'hostname' => 'foo', 'password' => 'bar', 'username' => 'bar'
|
38
|
+
connection.adapter = Netscaler::MockAdapter.new :body => '{ "errorcode": 0, "message": "Done" }'
|
39
|
+
|
40
|
+
context 'when using the show method in Rewrite::Policy' do
|
41
|
+
it 'with no param used it will return all rewrite policies' do
|
42
|
+
result = connection.rewrite.policy.show
|
43
|
+
result.should be_kind_of(Hash)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'supplying the name parameter will return Hash' do
|
47
|
+
result = connection.rewrite.policy.show :name => 'foo'
|
48
|
+
result.should be_kind_of(Hash)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'when showing a particular rewrite policy, string is invalid' do
|
52
|
+
expect {
|
53
|
+
connection.rewrite.policy.show('asdf')
|
54
|
+
}.should raise_error(TypeError, /conver(t|sion)/)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'when showing a particular rewrite policy :name is required' do
|
58
|
+
expect {
|
59
|
+
connection.rewrite.policy.show(:foo => 'bar')
|
60
|
+
}.should raise_error(ArgumentError, /name/)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netscaler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Custenborder
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
@@ -135,19 +135,23 @@ executables: []
|
|
135
135
|
extensions: []
|
136
136
|
extra_rdoc_files:
|
137
137
|
- LICENSE.txt
|
138
|
-
- README.
|
138
|
+
- README.md
|
139
139
|
files:
|
140
140
|
- .document
|
141
141
|
- .rspec
|
142
142
|
- Gemfile
|
143
143
|
- Gemfile.lock
|
144
144
|
- LICENSE.txt
|
145
|
-
- README.
|
145
|
+
- README.md
|
146
146
|
- Rakefile
|
147
147
|
- VERSION
|
148
148
|
- lib/netscaler.rb
|
149
149
|
- lib/netscaler/adapter.rb
|
150
150
|
- lib/netscaler/connection.rb
|
151
|
+
- lib/netscaler/cs.rb
|
152
|
+
- lib/netscaler/cs/vserver.rb
|
153
|
+
- lib/netscaler/cs/vserver/bind.rb
|
154
|
+
- lib/netscaler/cs/vserver/unbind.rb
|
151
155
|
- lib/netscaler/http_adapter.rb
|
152
156
|
- lib/netscaler/lb.rb
|
153
157
|
- lib/netscaler/lb/monitor.rb
|
@@ -160,13 +164,22 @@ files:
|
|
160
164
|
- lib/netscaler/netscaler_service.rb
|
161
165
|
- lib/netscaler/policy.rb
|
162
166
|
- lib/netscaler/policy/stringmap.rb
|
167
|
+
- lib/netscaler/responder.rb
|
168
|
+
- lib/netscaler/responder/action.rb
|
169
|
+
- lib/netscaler/responder/policy.rb
|
170
|
+
- lib/netscaler/rewrite.rb
|
171
|
+
- lib/netscaler/rewrite/action.rb
|
172
|
+
- lib/netscaler/rewrite/policy.rb
|
163
173
|
- lib/netscaler/server.rb
|
164
174
|
- lib/netscaler/service.rb
|
165
175
|
- lib/netscaler/servicegroup.rb
|
166
176
|
- netscaler.gemspec
|
177
|
+
- spec/csvserver_spec.rb
|
167
178
|
- spec/lbvserver_spec.rb
|
168
179
|
- spec/netscaler_spec.rb
|
169
180
|
- spec/policy_stringmap_spec.rb
|
181
|
+
- spec/responder_spec.rb
|
182
|
+
- spec/rewrite_spec.rb
|
170
183
|
- spec/server_spec.rb
|
171
184
|
- spec/service_spec.rb
|
172
185
|
- spec/servicegroup_spec.rb
|
data/README.rdoc
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
[![Build Status](https://travis-ci.org/GravityLabs/netscaler.svg?branch=master)](https://travis-ci.org/GravityLabs/netscaler)
|
2
|
-
|
3
|
-
= Netscaler Gem
|
4
|
-
|
5
|
-
A gem that uses the Netscaler {Nitro API}[http://support.citrix.com/proddocs/topic/netscaler-main-api-10-map/ns-nitro-wrapper-con.html] to access configs and stats. This has been tested only on Netscaler 9.3. Hoping to have Netscaler 10.0 support added in the near future.
|
6
|
-
|
7
|
-
= THIS IS PRE-ALPHA!!!
|
8
|
-
|
9
|
-
It is currently *Pre-Alpha* hence the 0-dot version and is suseptible to methods, classes and modules being renamed, added or deleted. I will try my best to back support as much as i can but will provide release notes of changes. Would love to get community support, i have access to a Netscaler and will add this to the spec as well down the road.
|
10
|
-
|
11
|
-
== TODO
|
12
|
-
|
13
|
-
* Add new definitions for deleting netscaler object entities
|
14
|
-
* Add stats
|
15
|
-
* Add support for Nitro 10.0, 10.1
|
16
|
-
|
17
|
-
== Contributing to Netscaler Gem
|
18
|
-
|
19
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
20
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
21
|
-
* Fork the project.
|
22
|
-
* Start a feature/bugfix branch.
|
23
|
-
* Commit and push until you are happy with your contribution.
|
24
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
25
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
26
|
-
|
27
|
-
== Copyright
|
28
|
-
|
29
|
-
Copyright (c) 2012 Jeremy Custenborder. See LICENSE.txt for
|
30
|
-
further details.
|
31
|
-
|