Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fmupdate_fgdsetting_serveroverride.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_fgdsetting_serveroverride
15 short_description: Cli fmupdate fgd setting server override
16 version_added: "2.10.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 fmupdate_fgdsetting_serveroverride:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 servlist:
27 type: list
28 elements: dict
29 description: Servlist.
30 suboptions:
31 id:
32 type: int
33 description: Id.
34 ip:
35 type: str
36 description: Ip.
37 ip6:
38 type: str
39 description: Ip6.
40 port:
41 type: int
42 description: Port.
43 service_type:
44 aliases: ['service-type']
45 type: str
46 description: Service type.
47 choices: ['fgd', 'fsa', 'fgfq', 'geoip', 'iot-collect']
48 status:
49 type: str
50 description: Status.
51 choices: ['disable', 'enable']
52 '''
53
54 EXAMPLES = '''
55 - name: Example playbook (generated based on argument schema)
56 hosts: fortimanagers
57 connection: httpapi
58 gather_facts: false
59 tasks:
60 - name: Cli fmupdate fgd setting server override
61 fortinet.fortimanager.fmgr_fmupdate_fgdsetting_serveroverride:
62 # workspace_locking_adom: <global or your adom name>
63 fmupdate_fgdsetting_serveroverride:
64 # servlist:
65 # - id: <integer>
66 # ip: <string>
67 # ip6: <string>
68 # port: <integer>
69 # service_type: <value in [fgd, fsa, fgfq, ...]>
70 # status: <value in [disable, enable]>
71 '''
72
73 RETURN = '''
74 meta:
75 description: The result of the request.
76 type: dict
77 returned: always
78 contains:
79 request_url:
80 description: The full url requested.
81 returned: always
82 type: str
83 sample: /sys/login/user
84 response_code:
85 description: The status of api request.
86 returned: always
87 type: int
88 sample: 0
89 response_data:
90 description: The api response.
91 type: list
92 returned: always
93 response_message:
94 description: The descriptive message of the api response.
95 type: str
96 returned: always
97 sample: OK.
98 system_information:
99 description: The information of the target system.
100 type: dict
101 returned: always
102 rc:
103 description: The status the request.
104 type: int
105 returned: always
106 sample: 0
107 version_check_warning:
108 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
109 type: list
110 returned: complex
111 '''
112 from ansible.module_utils.basic import AnsibleModule
113 from ansible.module_utils.connection import Connection
114 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
115 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
116
117
118 def main():
119 urls_list = [
120 '/cli/global/fmupdate/fgd-setting/server-override'
121 ]
122 module_arg_spec = {
123 'fmupdate_fgdsetting_serveroverride': {
124 'type': 'dict', 'v_range': [['7.6.3', '']],
125 'options': {
126 'servlist': {
127 'v_range': [['7.6.3', '']],
128 'type': 'list',
129 'options': {
130 'id': {'v_range': [['7.6.3', '']], 'type': 'int'},
131 'ip': {'v_range': [['7.6.3', '']], 'type': 'str'},
132 'ip6': {'v_range': [['7.6.3', '']], 'type': 'str'},
133 'port': {'v_range': [['7.6.3', '']], 'type': 'int'},
134 'service-type': {'v_range': [['7.6.3', '']], 'choices': ['fgd', 'fsa', 'fgfq', 'geoip', 'iot-collect'], 'type': 'str'}
135 },
136 'elements': 'dict'
137 },
138 'status': {'v_range': [['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
139 }
140 }
141 }
142
143 module_option_spec = get_module_arg_spec('partial crud')
144 module_arg_spec.update(module_option_spec)
145 check_galaxy_version(module_arg_spec)
146 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmupdate_fgdsetting_serveroverride'),
147 supports_check_mode=True)
148 if not module._socket_path:
149 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
150 connection = Connection(module._socket_path)
151 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
152 None, 'data', module, connection)
153 fmgr.process_partial_crud()
154 module.exit_json(meta=module.params)
155
156
157 if __name__ == '__main__':
158 main()