Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fmupdate_publicnetwork.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_publicnetwork
15 short_description: Enable/disable access to the public FortiGuard.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 fmupdate_publicnetwork:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 status:
27 type: str
28 description:
29 - Enable/disable public network
30 - disable - Disable setting.
31 - enable - Enable setting.
32 choices: ['disable', 'enable']
33 update_server_location:
34 aliases: ['update-server-location']
35 type: str
36 description: Update server location.
37 choices: ['global', 'usa', 'eu']
38 '''
39
40 EXAMPLES = '''
41 - name: Example playbook (generated based on argument schema)
42 hosts: fortimanagers
43 connection: httpapi
44 gather_facts: false
45 tasks:
46 - name: Enable/disable access to the public FortiGuard.
47 fortinet.fortimanager.fmgr_fmupdate_publicnetwork:
48 # workspace_locking_adom: <global or your adom name>
49 fmupdate_publicnetwork:
50 # status: <value in [disable, enable]>
51 # update_server_location: <value in [global, usa, eu]>
52 '''
53
54 RETURN = '''
55 meta:
56 description: The result of the request.
57 type: dict
58 returned: always
59 contains:
60 request_url:
61 description: The full url requested.
62 returned: always
63 type: str
64 sample: /sys/login/user
65 response_code:
66 description: The status of api request.
67 returned: always
68 type: int
69 sample: 0
70 response_data:
71 description: The api response.
72 type: list
73 returned: always
74 response_message:
75 description: The descriptive message of the api response.
76 type: str
77 returned: always
78 sample: OK.
79 system_information:
80 description: The information of the target system.
81 type: dict
82 returned: always
83 rc:
84 description: The status the request.
85 type: int
86 returned: always
87 sample: 0
88 version_check_warning:
89 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
90 type: list
91 returned: complex
92 '''
93 from ansible.module_utils.basic import AnsibleModule
94 from ansible.module_utils.connection import Connection
95 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
96 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
97
98
99 def main():
100 urls_list = [
101 '/cli/global/fmupdate/publicnetwork'
102 ]
103 module_arg_spec = {
104 'fmupdate_publicnetwork': {
105 'type': 'dict', 'v_range': [['6.0.0', '']],
106 'options': {
107 'status': {'choices': ['disable', 'enable'], 'type': 'str'},
108 'update-server-location': {'v_range': [['7.6.2', '']], 'choices': ['global', 'usa', 'eu'], 'type': 'str'}
109 }
110 }
111 }
112
113 module_option_spec = get_module_arg_spec('partial crud')
114 module_arg_spec.update(module_option_spec)
115 check_galaxy_version(module_arg_spec)
116 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmupdate_publicnetwork'),
117 supports_check_mode=True)
118 if not module._socket_path:
119 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
120 connection = Connection(module._socket_path)
121 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
122 None, 'data', module, connection)
123 fmgr.process_partial_crud()
124 module.exit_json(meta=module.params)
125
126
127 if __name__ == '__main__':
128 main()