Closed asrebroski closed 5 years ago
from fmcapi import FMC
from fmcapi.api_objects import AccessPolicies, AccessRules
with FMC(
host="hostname",
username="username",
password="password",
limit=1000,
autodeploy=False,
) as fmc_session:
policy = AccessPolicies(fmc=fmc_session).get(name="name_of_the_policy")
if not policy:
print("Policy could not be found")
else:
rules = AccessRules(fmc=fmc_session).get(acp_id=policy["id"])
if not rules:
print("Rules could not be loaded")
else:
for rule in rules["items"]:
print(f"Name: {rule['name']}: Dict: {rule}")
did that help @asrebroski ?
yes! Thank you so much. I very much appreciate it.
I am attempting to use the fmcapi to audit an FMC environment, specifically a way to programmatically output access control policy data in to a document. Is this a feasible use case and if so could you provide a code snippet to help me along?