Debian Codegraph @

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