Debian Codegraph @

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