Skip to content

Commit

Permalink
feat(panos_syslog_profile): Add network resource module states
Browse files Browse the repository at this point in the history
  • Loading branch information
shinmog committed Jul 26, 2022
1 parent f76b75c commit b50258e
Showing 1 changed file with 6 additions and 37 deletions.
43 changes: 6 additions & 37 deletions plugins/modules/panos_syslog_profile.py
Expand Up @@ -37,7 +37,7 @@
- paloaltonetworks.panos.fragments.transitional_provider
- paloaltonetworks.panos.fragments.vsys_shared
- paloaltonetworks.panos.fragments.device_group
- paloaltonetworks.panos.fragments.state
- paloaltonetworks.panos.fragments.network_resource_module_state
options:
name:
description:
Expand Down Expand Up @@ -138,11 +138,9 @@

try:
from panos.device import SyslogServerProfile
from panos.errors import PanDeviceError
except ImportError:
try:
from pandevice.device import SyslogServerProfile
from pandevice.errors import PanDeviceError
except ImportError:
pass

Expand All @@ -151,11 +149,12 @@ def main():
helper = get_connection(
vsys_shared=True,
device_group=True,
with_state=True,
with_network_resource_module_state=True,
with_classic_provider_spec=True,
min_pandevice_version=(0, 11, 1),
min_panos_version=(7, 1, 0),
argument_spec=dict(
sdk_cls=SyslogServerProfile,
sdk_params=dict(
name=dict(required=True),
config=dict(),
system=dict(),
Expand All @@ -175,44 +174,14 @@ def main():
escape_character=dict(),
),
)

module = AnsibleModule(
argument_spec=helper.argument_spec,
supports_check_mode=True,
required_one_of=helper.required_one_of,
)

# Verify imports, build pandevice object tree.
parent = helper.get_pandevice_parent(module)

try:
listing = SyslogServerProfile.refreshall(parent)
except PanDeviceError as e:
module.fail_json(msg="Failed refresh: {0}".format(e))

spec = {
"name": module.params["name"],
"config": module.params["config"],
"system": module.params["system"],
"threat": module.params["threat"],
"traffic": module.params["traffic"],
"hip_match": module.params["hip_match"],
"url": module.params["url"],
"data": module.params["data"],
"wildfire": module.params["wildfire"],
"tunnel": module.params["tunnel"],
"user_id": module.params["user_id"],
"gtp": module.params["gtp"],
"auth": module.params["auth"],
"sctp": module.params["sctp"],
"iptag": module.params["iptag"],
"escaped_characters": module.params["escaped_characters"],
"escape_character": module.params["escape_character"],
}
obj = SyslogServerProfile(**spec)
parent.add(obj)

changed, diff = helper.apply_state(obj, listing, module)
module.exit_json(changed=changed, diff=diff, msg="Done")
helper.process(module)


if __name__ == "__main__":
Expand Down

0 comments on commit b50258e

Please sign in to comment.