acos_client 0.1.0.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/acos_client.gemspec +29 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/acos_client/application.rb +91 -0
- data/lib/acos_client/client.rb +58 -0
- data/lib/acos_client/errors.rb +56 -0
- data/lib/acos_client/tools.rb +12 -0
- data/lib/acos_client/v21/action.rb +36 -0
- data/lib/acos_client/v21/axapi_http.rb +142 -0
- data/lib/acos_client/v21/base.rb +63 -0
- data/lib/acos_client/v21/config_file.rb +26 -0
- data/lib/acos_client/v21/device_info.rb +22 -0
- data/lib/acos_client/v21/ha.rb +29 -0
- data/lib/acos_client/v21/log.rb +117 -0
- data/lib/acos_client/v21/monkey_patch_ssl.rb +22 -0
- data/lib/acos_client/v21/nat.rb +53 -0
- data/lib/acos_client/v21/network.rb +167 -0
- data/lib/acos_client/v21/partition.rb +53 -0
- data/lib/acos_client/v21/responses.rb +170 -0
- data/lib/acos_client/v21/session.rb +61 -0
- data/lib/acos_client/v21/slb/aflex.rb +89 -0
- data/lib/acos_client/v21/slb/class_list.rb +67 -0
- data/lib/acos_client/v21/slb/hm.rb +122 -0
- data/lib/acos_client/v21/slb/init.rb +53 -0
- data/lib/acos_client/v21/slb/member.rb +36 -0
- data/lib/acos_client/v21/slb/port.rb +52 -0
- data/lib/acos_client/v21/slb/server.rb +65 -0
- data/lib/acos_client/v21/slb/service_group.rb +75 -0
- data/lib/acos_client/v21/slb/template/init.rb +28 -0
- data/lib/acos_client/v21/slb/template/persistence.rb +79 -0
- data/lib/acos_client/v21/slb/template/template_ssl.rb +56 -0
- data/lib/acos_client/v21/slb/virtual_port.rb +87 -0
- data/lib/acos_client/v21/slb/virtual_server.rb +62 -0
- data/lib/acos_client/v21/slb/virtual_service.rb +61 -0
- data/lib/acos_client/v21/system.rb +84 -0
- data/lib/acos_client/version.rb +3 -0
- data/lib/acos_client.rb +13 -0
- metadata +154 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'acos_client/v21/base'
|
2
|
+
|
3
|
+
module AcosClient
|
4
|
+
module V21
|
5
|
+
class BaseSSL < AcosClient::V21::BaseV21
|
6
|
+
|
7
|
+
def all(**opts)
|
8
|
+
self._get("slb.template.#{@template_type}.getAll", **opts)
|
9
|
+
end
|
10
|
+
|
11
|
+
def get(name, **opts)
|
12
|
+
self._post("slb.template.#{@template_type}.search", params: {:name => name}, **opts)
|
13
|
+
end
|
14
|
+
|
15
|
+
def _set(action, name, cert_name, key_name, **opts)
|
16
|
+
template = "#{@template_type}_template"
|
17
|
+
|
18
|
+
params = {
|
19
|
+
template => {
|
20
|
+
:cert_name => cert_name,
|
21
|
+
:key_name => key_name,
|
22
|
+
:name => name
|
23
|
+
}
|
24
|
+
}.deep_symbolize_keys!
|
25
|
+
self._post(action, params: params, **opts)
|
26
|
+
end
|
27
|
+
|
28
|
+
def create(name, cert_name, key_name, **opts)
|
29
|
+
self._set("slb.template.#{@template_type}.create", name, cert_name, key_name, **opts)
|
30
|
+
end
|
31
|
+
|
32
|
+
def update(name, cert_name, key_name, **opts)
|
33
|
+
self._set("slb.template.#{@template_type}.update", name, cert_name, key_name, **opts)
|
34
|
+
end
|
35
|
+
|
36
|
+
def delete(name, **opts)
|
37
|
+
self._post("slb.template.#{@template_type}.delete", params: {:name => name}, **opts)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class ClientSSL < BaseSSL
|
42
|
+
def initialize(client)
|
43
|
+
super(client)
|
44
|
+
@template_type = 'client_ssl'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class ServerSSL < BaseSSL
|
49
|
+
def initialize(client)
|
50
|
+
super(client)
|
51
|
+
@template_type = 'server_ssl'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'acos_client/v21/base'
|
2
|
+
|
3
|
+
module AcosClient
|
4
|
+
module V21
|
5
|
+
|
6
|
+
class VirtualPort < AcosClient::V21::BaseV21
|
7
|
+
|
8
|
+
# Protocols
|
9
|
+
TCP = 2
|
10
|
+
UDP = 3
|
11
|
+
HTTP = 11
|
12
|
+
HTTPS = 12
|
13
|
+
OTHERS = 4
|
14
|
+
RTSP = 5
|
15
|
+
FTP = 6
|
16
|
+
MMS = 7
|
17
|
+
SIP = 8
|
18
|
+
FAST_HTTP = 9
|
19
|
+
GENERIC_PROXY = 10
|
20
|
+
SSL_PROXY = 13
|
21
|
+
SMTP = 14
|
22
|
+
SIP_TCP = 15
|
23
|
+
SIPS = 16
|
24
|
+
DIAMETER = 17
|
25
|
+
DNS_UDP = 18
|
26
|
+
TFTP = 19
|
27
|
+
DNS_TCP = 20
|
28
|
+
RADIUS = 21
|
29
|
+
MYSQL = 22
|
30
|
+
MSSQL = 23
|
31
|
+
FIX = 24
|
32
|
+
SMPP_TCP = 25
|
33
|
+
SPDY = 26
|
34
|
+
SPDYS = 27
|
35
|
+
FTP_PROXY = 28
|
36
|
+
|
37
|
+
def _set(action, virtual_server_name, name, protocol, port, service_group_name,
|
38
|
+
s_pers_name=nil, c_pers_name=nil, status=1, **opts)
|
39
|
+
params = {
|
40
|
+
:name => virtual_server_name,
|
41
|
+
:vport => {
|
42
|
+
:name => name,
|
43
|
+
:service_group => service_group_name,
|
44
|
+
:protocol => protocol,
|
45
|
+
:port => port.to_i,
|
46
|
+
:source_ip_persistence_template => s_pers_name,
|
47
|
+
:cookie_persistence_template => c_pers_name,
|
48
|
+
:status => status
|
49
|
+
}.compact!
|
50
|
+
}
|
51
|
+
self._post(action, params: params, **opts)
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def create(virtual_server_name, name, protocol, port, service_group_name, s_pers_name=nil, c_pers_name=nil,
|
56
|
+
status=1, **opts)
|
57
|
+
|
58
|
+
self._set('slb.virtual_server.vport.create', virtual_server_name, name, protocol, port, service_group_name,
|
59
|
+
s_pers_name, c_pers_name, status, **opts)
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def update(virtual_server_name, name, protocol, port,
|
64
|
+
service_group_name,
|
65
|
+
s_pers_name=nil, c_pers_name=nil, status=1, **opts)
|
66
|
+
self._set('slb.virtual_server.vport.update', virtual_server_name,
|
67
|
+
name, protocol, port, service_group_name,
|
68
|
+
s_pers_name, c_pers_name, status, **opts)
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
def delete(virtual_server_name, name, protocol, port, **opts)
|
73
|
+
params = {
|
74
|
+
:name => virtual_server_name,
|
75
|
+
:vport => {
|
76
|
+
:name => name,
|
77
|
+
:protocol => protocol,
|
78
|
+
:port => port.to_i
|
79
|
+
}
|
80
|
+
}
|
81
|
+
self._post('slb.virtual_server.vport.delete', params: params, **opts)
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'acos_client/v21/base'
|
2
|
+
require 'acos_client/v21/slb/virtual_port'
|
3
|
+
|
4
|
+
module AcosClient
|
5
|
+
module V21
|
6
|
+
|
7
|
+
class VirtualServer < AcosClient::V21::BaseV21
|
8
|
+
|
9
|
+
def vport
|
10
|
+
VirtualPort.new(self.client)
|
11
|
+
end
|
12
|
+
|
13
|
+
def all(**opts)
|
14
|
+
self._get('slb.virtual_server.getAll', **opts)
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
def get(name, **opts)
|
19
|
+
self._post('slb.virtual_server.search', params: {:name => name}, **opts)
|
20
|
+
end
|
21
|
+
|
22
|
+
def _set(action, name, ip_address=nil, status=1, **opts)
|
23
|
+
params = {
|
24
|
+
:virtual_server => {
|
25
|
+
:name => name,
|
26
|
+
:address => ip_address,
|
27
|
+
:status => status,
|
28
|
+
}.compact!
|
29
|
+
}
|
30
|
+
self._post(action, params: params, **opts)
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def create(name, ip_address, status=1, **opts)
|
36
|
+
self._set('slb.virtual_server.create', name, ip_address, status, **opts)
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
def update(name, ip_address=nil, status=1, **opts)
|
41
|
+
self._set('slb.virtual_server.update', name, ip_address, status, **opts)
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def delete(name, **opts)
|
46
|
+
self._post('slb.virtual_server.delete', params: {:name => name}, **opts)
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def stats(name, **opts)
|
51
|
+
self._post('slb.virtual_server.fetchStatistics', params: {:name => name}, **opts)
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def all_stats(**opts)
|
56
|
+
self._get('slb.virtual_server.fetchAllStatistics', **opts)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'acos_client/v21/base'
|
2
|
+
|
3
|
+
module AcosClient
|
4
|
+
module V21
|
5
|
+
|
6
|
+
class VirtualService < AcosClient::V21::BaseV21
|
7
|
+
|
8
|
+
def all(**opts)
|
9
|
+
self._get('slb.virtual_service.getAll', **opts)
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(name, **opts)
|
13
|
+
self._post('slb.virtual_service.search', params: {:name => name}, **opts)
|
14
|
+
end
|
15
|
+
|
16
|
+
def _set(action, name, protocol, port, **opts)
|
17
|
+
params = {
|
18
|
+
:virtual_service => {
|
19
|
+
:port => port,
|
20
|
+
:protocol => protocol,
|
21
|
+
name => name
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
self._post(action, params: params, **opts)
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
def create(name, protocol, port, **opts)
|
30
|
+
self._set('slb.virtual_service.create', name, protocol, port, **opts)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def update(name, protocol, port, **opts)
|
35
|
+
self._set('slb.virtual_service.update', name, protocol, port, **opts)
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
def delete(name, **opts)
|
40
|
+
self._post('slb.virtual_service.delete', params: {:name => name}, **opts)
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def all_delete(**opts)
|
45
|
+
self._get('slb.virtual_service.deleteAll', **opts)
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
def stats(name, **opts)
|
50
|
+
self._post('slb.virtual_service.fetchStatistics', params: {:name => name}, **opts)
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def all_stats(**opts)
|
55
|
+
self._get('slb.virtual_service.fetchAllStatistics', **opts)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'acos_client/v21/base'
|
2
|
+
require 'acos_client/v21/device_info'
|
3
|
+
require 'acos_client/v21/action'
|
4
|
+
require 'acos_client/v21/partition'
|
5
|
+
require 'acos_client/v21/log'
|
6
|
+
require 'acos_client/v21/config_file'
|
7
|
+
|
8
|
+
|
9
|
+
module AcosClient
|
10
|
+
module V21
|
11
|
+
class System < AcosClient::V21::BaseV21
|
12
|
+
|
13
|
+
def backup(**opts)
|
14
|
+
self._get('system.backup', **opts)
|
15
|
+
end
|
16
|
+
|
17
|
+
def restore(name, data, **opts)
|
18
|
+
raise NotImplementedError, 'Restore Action is not implemented'
|
19
|
+
# m = multipart.Multipart()
|
20
|
+
# m.file(name="restore", filename=name, value=data)
|
21
|
+
# ct, payload = m.get()
|
22
|
+
# kwargs.update(payload=buffer(payload), headers={'Content-Type': ct})
|
23
|
+
# self._post("system.restore")
|
24
|
+
end
|
25
|
+
|
26
|
+
def tech_download
|
27
|
+
self._get('system.show_tech.download')
|
28
|
+
end
|
29
|
+
|
30
|
+
def information
|
31
|
+
self._get('system.information.get')
|
32
|
+
end
|
33
|
+
|
34
|
+
def device_info
|
35
|
+
DeviceInfo.new(self.client)
|
36
|
+
end
|
37
|
+
|
38
|
+
def action
|
39
|
+
Action.new(self.client)
|
40
|
+
end
|
41
|
+
|
42
|
+
def partition
|
43
|
+
Partition.new(self.client)
|
44
|
+
end
|
45
|
+
|
46
|
+
def config_file
|
47
|
+
ConfigFile.new(self.client)
|
48
|
+
end
|
49
|
+
|
50
|
+
def log
|
51
|
+
Log.new(self.client)
|
52
|
+
end
|
53
|
+
|
54
|
+
def banner
|
55
|
+
Banner.new(self.client)
|
56
|
+
end
|
57
|
+
|
58
|
+
class Banner < AcosClient::V21::BaseV21
|
59
|
+
def get(**opts)
|
60
|
+
self._get('system.banner.get', **opts)
|
61
|
+
end
|
62
|
+
|
63
|
+
def set(banner, **opts)
|
64
|
+
self._post('system.log.banner.set', params: {:banner => banner}, **opts)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def hostname
|
69
|
+
Hostname.new(self.client)
|
70
|
+
end
|
71
|
+
|
72
|
+
class Hostname < AcosClient::V21::BaseV21
|
73
|
+
def get(**opts)
|
74
|
+
self._get('system.hostname.get', **opts)
|
75
|
+
end
|
76
|
+
|
77
|
+
def set(hostname, **opts)
|
78
|
+
self._post('system.hostname.set', params: {:hostname => hostname}, **opts)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/lib/acos_client.rb
ADDED
metadata
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: acos_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.pre.alpha
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Amine Benseddik
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: httparty
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: addressable
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activesupport
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Port Python A10network AxAPI client to Ruby
|
84
|
+
email:
|
85
|
+
- amine.benseddik@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .travis.yml
|
91
|
+
- Gemfile
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
94
|
+
- acos_client.gemspec
|
95
|
+
- bin/console
|
96
|
+
- bin/setup
|
97
|
+
- lib/acos_client.rb
|
98
|
+
- lib/acos_client/application.rb
|
99
|
+
- lib/acos_client/client.rb
|
100
|
+
- lib/acos_client/errors.rb
|
101
|
+
- lib/acos_client/tools.rb
|
102
|
+
- lib/acos_client/v21/action.rb
|
103
|
+
- lib/acos_client/v21/axapi_http.rb
|
104
|
+
- lib/acos_client/v21/base.rb
|
105
|
+
- lib/acos_client/v21/config_file.rb
|
106
|
+
- lib/acos_client/v21/device_info.rb
|
107
|
+
- lib/acos_client/v21/ha.rb
|
108
|
+
- lib/acos_client/v21/log.rb
|
109
|
+
- lib/acos_client/v21/monkey_patch_ssl.rb
|
110
|
+
- lib/acos_client/v21/nat.rb
|
111
|
+
- lib/acos_client/v21/network.rb
|
112
|
+
- lib/acos_client/v21/partition.rb
|
113
|
+
- lib/acos_client/v21/responses.rb
|
114
|
+
- lib/acos_client/v21/session.rb
|
115
|
+
- lib/acos_client/v21/slb/aflex.rb
|
116
|
+
- lib/acos_client/v21/slb/class_list.rb
|
117
|
+
- lib/acos_client/v21/slb/hm.rb
|
118
|
+
- lib/acos_client/v21/slb/init.rb
|
119
|
+
- lib/acos_client/v21/slb/member.rb
|
120
|
+
- lib/acos_client/v21/slb/port.rb
|
121
|
+
- lib/acos_client/v21/slb/server.rb
|
122
|
+
- lib/acos_client/v21/slb/service_group.rb
|
123
|
+
- lib/acos_client/v21/slb/template/init.rb
|
124
|
+
- lib/acos_client/v21/slb/template/persistence.rb
|
125
|
+
- lib/acos_client/v21/slb/template/template_ssl.rb
|
126
|
+
- lib/acos_client/v21/slb/virtual_port.rb
|
127
|
+
- lib/acos_client/v21/slb/virtual_server.rb
|
128
|
+
- lib/acos_client/v21/slb/virtual_service.rb
|
129
|
+
- lib/acos_client/v21/system.rb
|
130
|
+
- lib/acos_client/version.rb
|
131
|
+
homepage: https://gitlab.spiir.me/amine/acos_client
|
132
|
+
licenses: []
|
133
|
+
metadata: {}
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '2.0'
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - '>'
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: 1.3.1
|
148
|
+
requirements: []
|
149
|
+
rubyforge_project:
|
150
|
+
rubygems_version: 2.4.6
|
151
|
+
signing_key:
|
152
|
+
specification_version: 4
|
153
|
+
summary: A10network AxAPI client
|
154
|
+
test_files: []
|