HistoryPurge: Clearing 219 old commits

This commit is contained in:
xpk
2024-10-24 23:09:21 +08:00
commit d08b7cac59
348 changed files with 376141 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
Sample code using [F5 python sdk](https://f5-sdk.readthedocs.io/en/latest/index.html)
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env python
from f5.bigip import ManagementRoot
# Connect to the BigIP
session = ManagementRoot("10.11.232.247", "username", "password")
datagroup = session.tm.ltm.data_group.internals.internal.load(name='domain1-WHITELIST', partition='Common')
# Print current record
print(datagroup.records)
# Update record
# datagroup.records = [{'name': '203.60.15.113/32', 'data': ''}, {'name': '222.186.30.174/32', 'data': ''},{'name': '120.136.32.106/32', 'data': ''}]
datagroup.records = [{'name': '203.60.15.113/32', 'data': ''}, {'name': '222.186.30.174/32', 'data': ''}]
datagroup.update()
# Print latest record
print(datagroup.records)
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env python
from f5.bigip import ManagementRoot
# Connect to the BigIP
mgmt = ManagementRoot("10.11.232.247", "username", "password")
# Get a list of all pools on the BigIP and print their names and their
# members' names
pools = mgmt.tm.ltm.pools.get_collection()
for pool in pools:
print(pool.name)
for member in pool.members_s.get_collection():
print(member.name)
def showDatagroups() :
print("\n\n**** Showing Datagroups")
dgs = mgmt.tm.ltm.data_group.internals.get_collection()
for idx, dg in enumerate(dgs):
if "WHITELIST" in dg.name:
# print("\n{}: {}".format(idx, dg.raw))
print("\n{}: {}".format(idx, dg.name))
if hasattr(dg, 'records'):
print("\n{}: {}".format(idx, dg.records))
#for record in dg.records:
# print("\nrec: {}".format(record))
else:
print("\nObject {} has no records".format(dg.name))
def showDatagroupFiles():
print("\n\n**** Showing DatagroupFiles")
dgFiles = mgmt.tm.sys.file.data_groups.get_collection()
for idx, f in enumerate(dgFiles):
print('\n{}: {}'.format(idx, f.raw))
if __name__ == "__main__":
showDatagroups()