Skip to content

Commit 2f98dd7

Browse files
authored
Merge pull request #1353 from jasonrahm/feature.logconfig
Feature #780 - Adds log destinations, publishers, and filters
2 parents 20d6a2f + 55973b8 commit 2f98dd7

4 files changed

Lines changed: 1233 additions & 0 deletions

File tree

f5/bigip/tm/sys/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from f5.bigip.tm.sys.global_settings import Global_Settings
4141
from f5.bigip.tm.sys.httpd import Httpd
4242
from f5.bigip.tm.sys.icall import Icall
43+
from f5.bigip.tm.sys.log_config import Log_Config
4344
from f5.bigip.tm.sys.management_ip import Management_Ips
4445
from f5.bigip.tm.sys.management_route import Management_Routes
4546
from f5.bigip.tm.sys.ntp import Ntp
@@ -70,6 +71,7 @@ def __init__(self, tm):
7071
Global_Settings,
7172
Httpd,
7273
Icall,
74+
Log_Config,
7375
Management_Ips,
7476
Management_Routes,
7577
Ntp,

f5/bigip/tm/sys/log_config.py

Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
# coding=utf-8
2+
#
3+
# Copyright 2017 F5 Networks Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
"""BIG-IP® system log-config module
18+
19+
REST URI
20+
``http://localhost/mgmt/tm/sys/log-config``
21+
22+
GUI Path
23+
N/A
24+
25+
REST Kind
26+
``tm:sys:log-config:*``
27+
"""
28+
29+
from f5.bigip.resource import Collection
30+
from f5.bigip.resource import OrganizingCollection
31+
from f5.bigip.resource import Resource
32+
from f5.sdk_exception import UnsupportedMethod
33+
34+
35+
class Log_Config(OrganizingCollection):
36+
def __init__(self, sys):
37+
super(Log_Config, self).__init__(sys)
38+
self._meta_data['allowed_lazy_attributes'] = [
39+
Destination,
40+
Filters,
41+
Publishers]
42+
43+
44+
class Destination(OrganizingCollection):
45+
def __init__(self, Log_Config):
46+
super(Destination, self).__init__(Log_Config)
47+
self._meta_data['allowed_lazy_attributes'] = [
48+
Alertds,
49+
Arcsights,
50+
Ipfixs,
51+
Local_Databases,
52+
Local_Syslogs,
53+
Management_Ports,
54+
Remote_High_Speed_Logs,
55+
Remote_Syslogs,
56+
Splunks]
57+
58+
59+
class Alertds(Collection):
60+
def __init__(self, Destination):
61+
super(Alertds, self).__init__(Destination)
62+
self._meta_data['allowed_lazy_attributes'] = [Alertd]
63+
self._meta_data['attribute_registry'] =\
64+
{'tm:sys:log-config:destination:alertd:alertdstate': Alertd}
65+
66+
67+
class Alertd(Resource):
68+
def __init__(self, alertds):
69+
super(Alertd, self).__init__(alertds)
70+
self._meta_data['required_json_kind'] =\
71+
'tm:sys:log-config:destination:alertd:alertdstate'
72+
73+
def create(self, **kwargs):
74+
'''Create is not supported for Alertd
75+
76+
:raises: UnsupportedOperation
77+
'''
78+
raise UnsupportedMethod(
79+
"%s does not support the create method" % self.__class__.__name__)
80+
81+
def delete(self, **kwargs):
82+
'''Delete is not supported for Alertd
83+
84+
:raises: UnsupportedOperation
85+
'''
86+
raise UnsupportedMethod(
87+
"%s does not support the delete method" % self.__class__.__name__)
88+
89+
90+
class Arcsights(Collection):
91+
def __init__(self, Destination):
92+
super(Arcsights, self).__init__(Destination)
93+
self._meta_data['allowed_lazy_attributes'] = [Arcsight]
94+
self._meta_data['attribute_registry'] =\
95+
{'tm:sys:log-config:destination:arcsight:arcsightstate': Arcsight}
96+
97+
98+
class Arcsight(Resource):
99+
def __init__(self, arcsights):
100+
super(Arcsight, self).__init__(arcsights)
101+
self._meta_data['required_json_kind'] =\
102+
'tm:sys:log-config:destination:arcsight:arcsightstate'
103+
self._meta_data['required_creation_parameters'].update(
104+
('name', 'forwardTo'))
105+
106+
107+
class Ipfixs(Collection):
108+
def __init__(self, Destination):
109+
super(Ipfixs, self).__init__(Destination)
110+
self._meta_data['allowed_lazy_attributes'] = [Ipfix]
111+
self._meta_data['attribute_registry'] =\
112+
{'tm:sys:log-config:destination:ipfix:ipfixstate': Ipfix}
113+
114+
115+
class Ipfix(Resource):
116+
def __init__(self, ipfixs):
117+
super(Ipfix, self).__init__(ipfixs)
118+
self._meta_data['required_json_kind'] =\
119+
'tm:sys:log-config:destination:ipfix:ipfixstate'
120+
self._meta_data['required_creation_parameters'].update(
121+
('name', 'poolName'))
122+
123+
124+
class Local_Databases(Collection):
125+
def __init__(self, Destination):
126+
super(Local_Databases, self).__init__(Destination)
127+
self._meta_data['allowed_lazy_attributes'] = [Local_Database]
128+
self._meta_data['attribute_registry'] =\
129+
{'tm:sys:log-config:destination:local-database:local-databasestate': Local_Database}
130+
131+
132+
class Local_Database(Resource):
133+
def __init__(self, local_databases):
134+
super(Local_Database, self).__init__(local_databases)
135+
self._meta_data['required_json_kind'] =\
136+
'tm:sys:log-config:destination:local-database:local-databasestate'
137+
138+
def create(self, **kwargs):
139+
'''Create is not supported for Local_Database
140+
141+
:raises: UnsupportedOperation
142+
'''
143+
raise UnsupportedMethod(
144+
"%s does not support the create method" % self.__class__.__name__)
145+
146+
def delete(self, **kwargs):
147+
'''Delete is not supported for Local_Database
148+
149+
:raises: UnsupportedOperation
150+
'''
151+
raise UnsupportedMethod(
152+
"%s does not support the delete method" % self.__class__.__name__)
153+
154+
155+
class Local_Syslogs(Collection):
156+
def __init__(self, Destination):
157+
super(Local_Syslogs, self).__init__(Destination)
158+
self._meta_data['allowed_lazy_attributes'] = [Local_Syslog]
159+
self._meta_data['attribute_registry'] = \
160+
{'tm:sys:log-config:destination:local-syslog:local-syslogstate': Local_Syslog}
161+
162+
163+
class Local_Syslog(Resource):
164+
def __init__(self, local_syslogs):
165+
super(Local_Syslog, self).__init__(local_syslogs)
166+
self._meta_data['required_json_kind'] = \
167+
'tm:sys:log-config:destination:local-syslog:local-syslogstate'
168+
169+
def create(self, **kwargs):
170+
'''Create is not supported for Local_Syslog
171+
172+
:raises: UnsupportedOperation
173+
'''
174+
raise UnsupportedMethod(
175+
"%s does not support the create method" % self.__class__.__name__)
176+
177+
def delete(self, **kwargs):
178+
'''Delete is not supported for Local_Syslog
179+
180+
:raises: UnsupportedOperation
181+
'''
182+
raise UnsupportedMethod(
183+
"%s does not support the delete method" % self.__class__.__name__)
184+
185+
186+
class Management_Ports(Collection):
187+
def __init__(self, Destination):
188+
super(Management_Ports, self).__init__(Destination)
189+
self._meta_data['allowed_lazy_attributes'] = [Management_Port]
190+
self._meta_data['attribute_registry'] =\
191+
{'tm:sys:log-config:destination:management-port:management-portstate': Management_Port}
192+
193+
194+
class Management_Port(Resource):
195+
def __init__(self, management_ports):
196+
super(Management_Port, self).__init__(management_ports)
197+
self._meta_data['required_json_kind'] =\
198+
'tm:sys:log-config:destination:management-port:management-portstate'
199+
self._meta_data['required_creation_parameters'].update(
200+
('name', 'ipAddress', 'port'))
201+
202+
203+
class Remote_High_Speed_Logs(Collection):
204+
def __init__(self, Destination):
205+
super(Remote_High_Speed_Logs, self).__init__(Destination)
206+
self._meta_data['allowed_lazy_attributes'] = [Remote_High_Speed_Log]
207+
self._meta_data['attribute_registry'] = \
208+
{'tm:sys:log-config:destination:remote-high-speed-log:remote-high-speed-logstate': Remote_High_Speed_Log}
209+
210+
211+
class Remote_High_Speed_Log(Resource):
212+
def __init__(self, remote_high_speed_logs):
213+
super(Remote_High_Speed_Log, self).__init__(remote_high_speed_logs)
214+
self._meta_data['required_json_kind'] = \
215+
'tm:sys:log-config:destination:remote-high-speed-log:remote-high-speed-logstate'
216+
self._meta_data['required_creation_parameters'].update(
217+
('name', 'poolName'))
218+
219+
220+
class Remote_Syslogs(Collection):
221+
def __init__(self, Destination):
222+
super(Remote_Syslogs, self).__init__(Destination)
223+
self._meta_data['allowed_lazy_attributes'] = [Remote_Syslog]
224+
self._meta_data['attribute_registry'] = \
225+
{'tm:sys:log-config:destination:remote-syslog:remote-syslogstate': Remote_Syslog}
226+
227+
228+
class Remote_Syslog(Resource):
229+
def __init__(self, remote_syslogs):
230+
super(Remote_Syslog, self).__init__(remote_syslogs)
231+
self._meta_data['required_json_kind'] = \
232+
'tm:sys:log-config:destination:remote-syslog:remote-syslogstate'
233+
self._meta_data['required_creation_parameters'].update(
234+
('name', 'remoteHighSpeedLog'))
235+
236+
237+
class Splunks(Collection):
238+
def __init__(self, Destination):
239+
super(Splunks, self).__init__(Destination)
240+
self._meta_data['allowed_lazy_attributes'] = [Splunk]
241+
self._meta_data['attribute_registry'] = \
242+
{'tm:sys:log-config:destination:splunk:splunkstate': Splunk}
243+
244+
245+
class Splunk(Resource):
246+
def __init__(self, splunks):
247+
super(Splunk, self).__init__(splunks)
248+
self._meta_data['required_json_kind'] = \
249+
'tm:sys:log-config:destination:splunk:splunkstate'
250+
self._meta_data['required_creation_parameters'].update(
251+
('name', 'forwardTo'))
252+
253+
254+
class Filters(Collection):
255+
def __init__(self, Log_Config):
256+
super(Filters, self).__init__(Log_Config)
257+
self._meta_data['allowed_lazy_attributes'] = [Filter]
258+
self._meta_data['attribute_registry'] =\
259+
{'tm:sys:log-config:filter:filterstate': Filter}
260+
261+
262+
class Filter(Resource):
263+
def __init__(self, filters):
264+
super(Filter, self).__init__(filters)
265+
self._meta_data['required_json_kind'] =\
266+
'tm:sys:log-config:filter:filterstate'
267+
self._meta_data['required_creation_parameters'].update(
268+
('name', 'publisher'))
269+
270+
271+
class Publishers(Collection):
272+
def __init__(self, Log_Config):
273+
super(Publishers, self).__init__(Log_Config)
274+
self._meta_data['allowed_lazy_attributes'] = [Publisher]
275+
self._meta_data['attribute_registry'] =\
276+
{'tm:sys:log-config:publisher:publisherstate': Publisher}
277+
278+
279+
class Publisher(Resource):
280+
def __init__(self, publishers):
281+
super(Publisher, self).__init__(publishers)
282+
self._meta_data['required_json_kind'] =\
283+
'tm:sys:log-config:publisher:publisherstate'
284+
self._meta_data['required_creation_parameters'].update(
285+
('name',))

0 commit comments

Comments
 (0)