Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_securityconsole_package_clone.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_securityconsole_package_clone
15 short_description: Clone a policy package within the same ADOM.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 options:
20 securityconsole_package_clone:
21 description: The top level parameters set.
22 required: false
23 type: dict
24 suboptions:
25 adom:
26 type: str
27 description: Source ADOM name.
28 dst_name:
29 type: str
30 description: Name of the new policy package.
31 dst_parent:
32 type: str
33 description: Path to the folder for the target package.
34 pkg:
35 type: str
36 description: Source package path and name.
37 scope:
38 type: list
39 elements: dict
40 description: Scope.
41 suboptions:
42 name:
43 type: str
44 description: Name.
45 vdom:
46 type: str
47 description: Vdom.
48 '''
49
50 EXAMPLES = '''
51 - name: Example playbook (generated based on argument schema)
52 hosts: fortimanagers
53 connection: httpapi
54 gather_facts: false
55 tasks:
56 - name: Clone a policy package within the same ADOM.
57 fortinet.fortimanager.fmgr_securityconsole_package_clone:
58 # workspace_locking_adom: <global or your adom name>
59 securityconsole_package_clone:
60 # adom: <string>
61 # dst_name: <string>
62 # dst_parent: <string>
63 # pkg: <string>
64 # scope:
65 # - name: <string>
66 # vdom: <string>
67 '''
68
69 RETURN = '''
70 meta:
71 description: The result of the request.
72 type: dict
73 returned: always
74 contains:
75 request_url:
76 description: The full url requested.
77 returned: always
78 type: str
79 sample: /sys/login/user
80 response_code:
81 description: The status of api request.
82 returned: always
83 type: int
84 sample: 0
85 response_data:
86 description: The api response.
87 type: list
88 returned: always
89 response_message:
90 description: The descriptive message of the api response.
91 type: str
92 returned: always
93 sample: OK.
94 system_information:
95 description: The information of the target system.
96 type: dict
97 returned: always
98 rc:
99 description: The status the request.
100 type: int
101 returned: always
102 sample: 0
103 version_check_warning:
104 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
105 type: list
106 returned: complex
107 '''
108 from ansible.module_utils.basic import AnsibleModule
109 from ansible.module_utils.connection import Connection
110 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
111 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
112
113
114 def main():
115 urls_list = [
116 '/securityconsole/package/clone'
117 ]
118 module_arg_spec = {
119 'securityconsole_package_clone': {
120 'type': 'dict', 'v_range': [['6.0.0', '']],
121 'options': {
122 'adom': {'type': 'str'},
123 'dst_name': {'type': 'str'},
124 'dst_parent': {'type': 'str'},
125 'pkg': {'type': 'str'},
126 'scope': {'type': 'list', 'options': {'name': {'type': 'str'}, 'vdom': {'type': 'str'}}, 'elements': 'dict'}
127 }
128 }
129 }
130
131 module_option_spec = get_module_arg_spec('exec')
132 module_arg_spec.update(module_option_spec)
133 check_galaxy_version(module_arg_spec)
134 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'securityconsole_package_clone'),
135 supports_check_mode=True)
136 if not module._socket_path:
137 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
138 connection = Connection(module._socket_path)
139 fmgr = NAPIManager('exec', module_arg_spec, urls_list,
140 None, 'data', module, connection)
141 fmgr.process_exec()
142 module.exit_json(meta=module.params)
143
144
145 if __name__ == '__main__':
146 main()