Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_pm_pblock_adom.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_pm_pblock_adom
15 short_description: Policy block adom
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 adom:
22 description: The parameter (adom) in requested url.
23 type: str
24 required: true
25 pm_pblock_adom:
26 description: The top level parameters set.
27 required: false
28 type: dict
29 suboptions:
30 name:
31 type: str
32 description: Name.
33 oid:
34 type: int
35 description: Oid.
36 package_settings:
37 aliases: ['package settings']
38 type: dict
39 description: Package settings.
40 suboptions:
41 central_nat:
42 aliases: ['central-nat']
43 type: str
44 description: Central nat.
45 choices: ['disable', 'enable']
46 consolidated_firewall_mode:
47 aliases: ['consolidated-firewall-mode']
48 type: str
49 description: Consolidated firewall mode.
50 choices: ['disable', 'enable']
51 fwpolicy_implicit_log:
52 aliases: ['fwpolicy-implicit-log']
53 type: str
54 description: Fwpolicy implicit log.
55 choices: ['disable', 'enable']
56 fwpolicy6_implicit_log:
57 aliases: ['fwpolicy6-implicit-log']
58 type: str
59 description: Fwpolicy6 implicit log.
60 choices: ['disable', 'enable']
61 inspection_mode:
62 aliases: ['inspection-mode']
63 type: str
64 description: Inspection mode.
65 choices: ['proxy', 'flow']
66 ngfw_mode:
67 aliases: ['ngfw-mode']
68 type: str
69 description: Ngfw mode.
70 choices: ['profile-based', 'policy-based']
71 policy_offload_level:
72 aliases: ['policy-offload-level']
73 type: str
74 description: Policy offload level.
75 choices: ['disable', 'default', 'dos-offload', 'full-offload']
76 ssl_ssh_profile:
77 aliases: ['ssl-ssh-profile']
78 type: str
79 description: Ssl ssh profile.
80 type:
81 type: str
82 description: Type.
83 choices: ['pblock']
84 '''
85
86 EXAMPLES = '''
87 - name: Example playbook (generated based on argument schema)
88 hosts: fortimanagers
89 connection: httpapi
90 gather_facts: false
91 tasks:
92 - name: Policy block adom
93 fortinet.fortimanager.fmgr_pm_pblock_adom:
94 # workspace_locking_adom: <global or your adom name>
95 adom: <your own value>
96 pm_pblock_adom:
97 # name: <string>
98 # oid: <integer>
99 # package_settings:
100 # central_nat: <value in [disable, enable]>
101 # consolidated_firewall_mode: <value in [disable, enable]>
102 # fwpolicy_implicit_log: <value in [disable, enable]>
103 # fwpolicy6_implicit_log: <value in [disable, enable]>
104 # inspection_mode: <value in [proxy, flow]>
105 # ngfw_mode: <value in [profile-based, policy-based]>
106 # policy_offload_level: <value in [disable, default, dos-offload, ...]>
107 # ssl_ssh_profile: <string>
108 # type: <value in [pblock]>
109 '''
110
111 RETURN = '''
112 meta:
113 description: The result of the request.
114 type: dict
115 returned: always
116 contains:
117 request_url:
118 description: The full url requested.
119 returned: always
120 type: str
121 sample: /sys/login/user
122 response_code:
123 description: The status of api request.
124 returned: always
125 type: int
126 sample: 0
127 response_data:
128 description: The api response.
129 type: list
130 returned: always
131 response_message:
132 description: The descriptive message of the api response.
133 type: str
134 returned: always
135 sample: OK.
136 system_information:
137 description: The information of the target system.
138 type: dict
139 returned: always
140 rc:
141 description: The status the request.
142 type: int
143 returned: always
144 sample: 0
145 version_check_warning:
146 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
147 type: list
148 returned: complex
149 '''
150 from ansible.module_utils.basic import AnsibleModule
151 from ansible.module_utils.connection import Connection
152 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
153 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
154
155
156 def main():
157 urls_list = [
158 '/pm/pblock/adom/{adom}'
159 ]
160 module_arg_spec = {
161 'adom': {'required': True, 'type': 'str'},
162 'pm_pblock_adom': {
163 'type': 'dict', 'v_range': [['7.0.3', '']],
164 'options': {
165 'name': {'v_range': [['7.0.3', '']], 'type': 'str'},
166 'oid': {'v_range': [['7.0.3', '']], 'type': 'int'},
167 'package settings': {
168 'v_range': [['7.0.3', '']],
169 'type': 'dict',
170 'options': {
171 'central-nat': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
172 'consolidated-firewall-mode': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
173 'fwpolicy-implicit-log': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
174 'fwpolicy6-implicit-log': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
175 'inspection-mode': {'v_range': [['7.0.3', '']], 'choices': ['proxy', 'flow'], 'type': 'str'},
176 'ngfw-mode': {'v_range': [['7.0.3', '']], 'choices': ['profile-based', 'policy-based'], 'type': 'str'},
177 'policy-offload-level': {
178 'v_range': [['7.0.3', '']],
179 'choices': ['disable', 'default', 'dos-offload', 'full-offload'],
180 'type': 'str'
181 },
182 'ssl-ssh-profile': {'v_range': [['7.0.3', '']], 'type': 'str'}
183 }
184 },
185 'type': {'v_range': [['7.0.3', '']], 'choices': ['pblock'], 'type': 'str'}
186 }
187 }
188 }
189
190 module_option_spec = get_module_arg_spec('partial crud')
191 module_arg_spec.update(module_option_spec)
192 check_galaxy_version(module_arg_spec)
193 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'pm_pblock_adom'),
194 supports_check_mode=True)
195 if not module._socket_path:
196 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
197 connection = Connection(module._socket_path)
198 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
199 None, 'data', module, connection)
200 fmgr.process_partial_crud()
201 module.exit_json(meta=module.params)
202
203
204 if __name__ == '__main__':
205 main()