Debian Codegraph @

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