Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fmupdate_serveraccesspriorities.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_fmupdate_serveraccesspriorities
15 short_description: Configure priorities for FortiGate units accessing antivirus updates and web filtering services.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 fmupdate_serveraccesspriorities:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 access_public:
27 aliases: ['access-public']
28 type: str
29 description:
30 - Enable/disable FortiGates to Access Public FortiGuard Servers when Private Servers are Unavailable
31 - disable - Disable setting.
32 - enable - Enable setting.
33 choices: ['disable', 'enable']
34 av_ips:
35 aliases: ['av-ips']
36 type: str
37 description:
38 - Enable/disable Antivirus and IPS Update Service for Private Server
39 - disable - Disable setting.
40 - enable - Enable setting.
41 choices: ['disable', 'enable']
42 private_server:
43 aliases: ['private-server']
44 type: list
45 elements: dict
46 description: Private server.
47 suboptions:
48 id:
49 type: int
50 description: Private server ID
51 ip:
52 type: str
53 description: IPv4 address of the FortiManager unit or private server.
54 ip6:
55 type: str
56 description: IPv6 address of the FortiManager unit or private server.
57 time_zone:
58 type: int
59 description: Time zone of the private server
60 web_spam:
61 aliases: ['web-spam']
62 type: str
63 description:
64 - Enable/disable Web Filter and Email Filter Update Service for Private Server
65 - disable - Disable setting.
66 - enable - Enable setting.
67 choices: ['disable', 'enable']
68 '''
69
70 EXAMPLES = '''
71 - name: Example playbook (generated based on argument schema)
72 hosts: fortimanagers
73 connection: httpapi
74 gather_facts: false
75 tasks:
76 - name: Configure priorities for FortiGate units accessing antivirus updates and web filtering services.
77 fortinet.fortimanager.fmgr_fmupdate_serveraccesspriorities:
78 # workspace_locking_adom: <global or your adom name>
79 fmupdate_serveraccesspriorities:
80 # access_public: <value in [disable, enable]>
81 # av_ips: <value in [disable, enable]>
82 # private_server:
83 # - id: <integer>
84 # ip: <string>
85 # ip6: <string>
86 # time_zone: <integer>
87 # web_spam: <value in [disable, enable]>
88 '''
89
90 RETURN = '''
91 meta:
92 description: The result of the request.
93 type: dict
94 returned: always
95 contains:
96 request_url:
97 description: The full url requested.
98 returned: always
99 type: str
100 sample: /sys/login/user
101 response_code:
102 description: The status of api request.
103 returned: always
104 type: int
105 sample: 0
106 response_data:
107 description: The api response.
108 type: list
109 returned: always
110 response_message:
111 description: The descriptive message of the api response.
112 type: str
113 returned: always
114 sample: OK.
115 system_information:
116 description: The information of the target system.
117 type: dict
118 returned: always
119 rc:
120 description: The status the request.
121 type: int
122 returned: always
123 sample: 0
124 version_check_warning:
125 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
126 type: list
127 returned: complex
128 '''
129 from ansible.module_utils.basic import AnsibleModule
130 from ansible.module_utils.connection import Connection
131 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
132 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
133
134
135 def main():
136 urls_list = [
137 '/cli/global/fmupdate/server-access-priorities'
138 ]
139 module_arg_spec = {
140 'fmupdate_serveraccesspriorities': {
141 'type': 'dict', 'v_range': [['6.0.0', '']],
142 'options': {
143 'access-public': {'choices': ['disable', 'enable'], 'type': 'str'},
144 'av-ips': {'choices': ['disable', 'enable'], 'type': 'str'},
145 'private-server': {
146 'type': 'list',
147 'options': {'id': {'type': 'int'}, 'ip': {'type': 'str'}, 'ip6': {'type': 'str'}, 'time_zone': {'type': 'int'}},
148 'elements': 'dict'
149 },
150 'web-spam': {'choices': ['disable', 'enable'], 'type': 'str'}
151 }
152 }
153 }
154
155 module_option_spec = get_module_arg_spec('partial crud')
156 module_arg_spec.update(module_option_spec)
157 check_galaxy_version(module_arg_spec)
158 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmupdate_serveraccesspriorities'),
159 supports_check_mode=True)
160 if not module._socket_path:
161 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
162 connection = Connection(module._socket_path)
163 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
164 None, 'data', module, connection)
165 fmgr.process_partial_crud()
166 module.exit_json(meta=module.params)
167
168
169 if __name__ == '__main__':
170 main()