Debian Codegraph @

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