Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_internetserviceextension_disableentry.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_firewall_internetserviceextension_disableentry
15 short_description: Disable entries in the Internet Service database.
16 version_added: "2.10.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 internet-service-extension:
29 description: Deprecated, please use "internet_service_extension"
30 type: str
31 internet_service_extension:
32 description: The parameter (internet-service-extension) in requested url.
33 type: str
34 firewall_internetserviceextension_disableentry:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 addr_mode:
40 aliases: ['addr-mode']
41 type: str
42 description: Address mode
43 choices: ['ipv4', 'ipv6']
44 id:
45 type: int
46 description: Disable entry ID.
47 required: true
48 ip_range:
49 aliases: ['ip-range']
50 type: list
51 elements: dict
52 description: Ip range.
53 suboptions:
54 end_ip:
55 aliases: ['end-ip']
56 type: str
57 description: End IPv4 address.
58 id:
59 type: int
60 description: Disable entry range ID.
61 start_ip:
62 aliases: ['start-ip']
63 type: str
64 description: Start IPv4 address.
65 ip6_range:
66 aliases: ['ip6-range']
67 type: list
68 elements: dict
69 description: Ip6 range.
70 suboptions:
71 end_ip6:
72 aliases: ['end-ip6']
73 type: str
74 description: End IPv6 address.
75 id:
76 type: int
77 description: Disable entry range ID.
78 start_ip6:
79 aliases: ['start-ip6']
80 type: str
81 description: Start IPv6 address.
82 port_range:
83 aliases: ['port-range']
84 type: list
85 elements: dict
86 description: Port range.
87 suboptions:
88 end_port:
89 aliases: ['end-port']
90 type: int
91 description: Ending TCP/UDP/SCTP destination port
92 id:
93 type: int
94 description: Custom entry port range ID.
95 start_port:
96 aliases: ['start-port']
97 type: int
98 description: Starting TCP/UDP/SCTP destination port
99 protocol:
100 type: int
101 description: Integer value for the protocol type as defined by IANA
102 '''
103
104 EXAMPLES = '''
105 - name: Example playbook (generated based on argument schema)
106 hosts: fortimanagers
107 connection: httpapi
108 gather_facts: false
109 tasks:
110 - name: Disable entries in the Internet Service database.
111 fortinet.fortimanager.fmgr_firewall_internetserviceextension_disableentry:
112 # workspace_locking_adom: <global or your adom name>
113 adom: <your own value>
114 internet_service_extension: <your own value>
115 state: present # <value in [present, absent]>
116 firewall_internetserviceextension_disableentry:
117 id: 0 # Required variable, integer
118 # addr_mode: <value in [ipv4, ipv6]>
119 # ip_range:
120 # - end_ip: <string>
121 # id: <integer>
122 # start_ip: <string>
123 # ip6_range:
124 # - end_ip6: <string>
125 # id: <integer>
126 # start_ip6: <string>
127 # port_range:
128 # - end_port: <integer>
129 # id: <integer>
130 # start_port: <integer>
131 # protocol: <integer>
132 '''
133
134 RETURN = '''
135 meta:
136 description: The result of the request.
137 type: dict
138 returned: always
139 contains:
140 request_url:
141 description: The full url requested.
142 returned: always
143 type: str
144 sample: /sys/login/user
145 response_code:
146 description: The status of api request.
147 returned: always
148 type: int
149 sample: 0
150 response_data:
151 description: The api response.
152 type: list
153 returned: always
154 response_message:
155 description: The descriptive message of the api response.
156 type: str
157 returned: always
158 sample: OK.
159 system_information:
160 description: The information of the target system.
161 type: dict
162 returned: always
163 rc:
164 description: The status the request.
165 type: int
166 returned: always
167 sample: 0
168 version_check_warning:
169 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
170 type: list
171 returned: complex
172 '''
173 from ansible.module_utils.basic import AnsibleModule
174 from ansible.module_utils.connection import Connection
175 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
176 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
177
178
179 def main():
180 urls_list = [
181 '/pm/config/adom/{adom}/obj/firewall/internet-service-extension/{internet-service-extension}/disable-entry',
182 '/pm/config/global/obj/firewall/internet-service-extension/{internet-service-extension}/disable-entry'
183 ]
184 module_arg_spec = {
185 'adom': {'required': True, 'type': 'str'},
186 'internet-service-extension': {'type': 'str', 'api_name': 'internet_service_extension'},
187 'internet_service_extension': {'type': 'str'},
188 'revision_note': {'type': 'str'},
189 'firewall_internetserviceextension_disableentry': {
190 'type': 'dict', 'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']],
191 'options': {
192 'addr-mode': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'choices': ['ipv4', 'ipv6'], 'type': 'str'},
193 'id': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'required': True, 'type': 'int'},
194 'ip-range': {
195 'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']],
196 'type': 'list',
197 'options': {
198 'end-ip': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'type': 'str'},
199 'id': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'type': 'int'},
200 'start-ip': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'type': 'str'}
201 },
202 'elements': 'dict'
203 },
204 'ip6-range': {
205 'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']],
206 'type': 'list',
207 'options': {
208 'end-ip6': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'type': 'str'},
209 'id': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'type': 'int'},
210 'start-ip6': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'type': 'str'}
211 },
212 'elements': 'dict'
213 },
214 'port-range': {
215 'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']],
216 'type': 'list',
217 'options': {
218 'end-port': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'type': 'int'},
219 'id': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'type': 'int'},
220 'start-port': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'type': 'int'}
221 },
222 'elements': 'dict'
223 },
224 'protocol': {'v_range': [['7.4.7', '7.4.10'], ['7.6.4', '']], 'type': 'int'}
225 }
226 }
227 }
228
229 module_option_spec = get_module_arg_spec('full crud')
230 module_arg_spec.update(module_option_spec)
231 check_galaxy_version(module_arg_spec)
232 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_internetserviceextension_disableentry'),
233 supports_check_mode=True)
234 if not module._socket_path:
235 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
236 connection = Connection(module._socket_path)
237 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
238 'id', 'data', module, connection)
239 fmgr.process_crud()
240 module.exit_json(meta=module.params)
241
242
243 if __name__ == '__main__':
244 main()