Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_add_nat_rule.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #
4 # Ansible module to manage CheckPoint Firewall (c) 2019
5 #
6 # Ansible is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # Ansible is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 from __future__ import absolute_import, division, print_function
21
22 __metaclass__ = type
23
24 ANSIBLE_METADATA = {
25 "metadata_version": "1.1",
26 "status": ["deprecated"],
27 "supported_by": "community",
28 }
29
30 DOCUMENTATION = """
31 ---
32 module: cp_mgmt_add_nat_rule
33 short_description: Create new object.
34 description:
35 - Create new object.
36 - All operations are performed over Web Services API.
37 - Available from R80 management version.
38 version_added: "2.0.0"
39 author: "Or Soffer (@chkp-orso)"
40 deprecated:
41 alternative: cp_mgmt_nat_rule
42 why: Newer and updated module released with more functionality.
43 removed_at_date: '2024-11-01'
44 options:
45 package:
46 description:
47 - Name of the package.
48 type: str
49 position:
50 description:
51 - Position in the rulebase.
52 type: str
53 enabled:
54 description:
55 - Enable/Disable the rule.
56 type: bool
57 install_on:
58 description:
59 - Which Gateways identified by the name or UID to install the policy on.
60 type: list
61 elements: str
62 method:
63 description:
64 - Nat method.
65 type: str
66 choices: ['static', 'hide', 'nat64', 'nat46']
67 original_destination:
68 description:
69 - Original destination.
70 type: str
71 original_service:
72 description:
73 - Original service.
74 type: str
75 original_source:
76 description:
77 - Original source.
78 type: str
79 translated_destination:
80 description:
81 - Translated destination.
82 type: str
83 translated_service:
84 description:
85 - Translated service.
86 type: str
87 translated_source:
88 description:
89 - Translated source.
90 type: str
91 comments:
92 description:
93 - Comments string.
94 type: str
95 details_level:
96 description:
97 - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed
98 representation of the object.
99 type: str
100 choices: ['uid', 'standard', 'full']
101 ignore_warnings:
102 description:
103 - Apply changes ignoring warnings.
104 type: bool
105 ignore_errors:
106 description:
107 - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored.
108 type: bool
109 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
110 """
111
112 EXAMPLES = """
113 - name: add-nat-rule
114 cp_mgmt_add_nat_rule:
115 comments: comment example1 nat999
116 enabled: false
117 install_on:
118 - Policy Targets
119 original_destination: All_Internet
120 original_source: Any
121 package: standard
122 position: 1
123 """
124
125 RETURN = """
126 cp_mgmt_add_nat_rule:
127 description: The checkpoint add-nat-rule output.
128 returned: always.
129 type: dict
130 """
131
132 from ansible.module_utils.basic import AnsibleModule
133 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
134 checkpoint_argument_spec_for_commands,
135 api_command,
136 )
137
138
139 def main():
140 argument_spec = dict(
141 package=dict(type="str"),
142 position=dict(type="str"),
143 enabled=dict(type="bool"),
144 install_on=dict(type="list", elements="str"),
145 method=dict(type="str", choices=["static", "hide", "nat64", "nat46"]),
146 original_destination=dict(type="str"),
147 original_service=dict(type="str"),
148 original_source=dict(type="str"),
149 translated_destination=dict(type="str"),
150 translated_service=dict(type="str"),
151 translated_source=dict(type="str"),
152 comments=dict(type="str"),
153 details_level=dict(type="str", choices=["uid", "standard", "full"]),
154 ignore_warnings=dict(type="bool"),
155 ignore_errors=dict(type="bool"),
156 )
157 argument_spec.update(checkpoint_argument_spec_for_commands)
158
159 module = AnsibleModule(argument_spec=argument_spec)
160
161 command = "add-nat-rule"
162
163 result = api_command(module, command)
164 module.exit_json(**result)
165
166
167 if __name__ == "__main__":
168 main()