Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_pm_devprof_adom.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_adom
15 short_description: System template adom
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 adom:
22 description: The parameter (adom) in requested url.
23 type: str
24 required: true
25 pm_devprof_adom:
26 description: The top level parameters set.
27 required: false
28 type: dict
29 suboptions:
30 description:
31 type: str
32 description: Description.
33 enabled_options:
34 aliases: ['enabled options']
35 type: list
36 elements: str
37 description: Enabled options.
38 choices: ['none', 'dns', 'ntp', 'email', 'admin', 'snmp', 'repmsg', 'ftgd', 'log']
39 name:
40 type: str
41 description: Name.
42 oid:
43 type: int
44 description: Oid.
45 scope_member:
46 aliases: ['scope member']
47 type: list
48 elements: dict
49 description: Scope member.
50 suboptions:
51 name:
52 type: str
53 description: Name.
54 vdom:
55 type: str
56 description: Vdom.
57 type:
58 type: str
59 description: Type.
60 choices: ['devprof']
61 '''
62
63 EXAMPLES = '''
64 - name: Example playbook
65 hosts: fortimanagers
66 gather_facts: false
67 connection: httpapi
68 vars:
69 ansible_httpapi_use_ssl: true
70 ansible_httpapi_validate_certs: false
71 ansible_httpapi_port: 443
72 tasks:
73 - name: Run fmgr_pm_devprof_adom
74 fortinet.fortimanager.fmgr_pm_devprof_adom:
75 adom: ansible
76 pm_devprof_adom:
77 description: "ansible-test"
78 enabled_options:
79 - none
80 - dns
81 - ntp
82 - email
83 - admin
84 - snmp
85 - repmsg
86 - ftgd
87 - log
88 name: "ansible-test"
89 oid: 1500
90 type: devprof
91
92 - name: Gathering fortimanager facts
93 hosts: fortimanagers
94 gather_facts: false
95 connection: httpapi
96 vars:
97 ansible_httpapi_use_ssl: true
98 ansible_httpapi_validate_certs: false
99 ansible_httpapi_port: 443
100 tasks:
101 - name: Get fact
102 fortinet.fortimanager.fmgr_fact:
103 facts:
104 selector: "pm_devprof_adom"
105 params:
106 adom: "ansible"
107 '''
108
109 RETURN = '''
110 meta:
111 description: The result of the request.
112 type: dict
113 returned: always
114 contains:
115 request_url:
116 description: The full url requested.
117 returned: always
118 type: str
119 sample: /sys/login/user
120 response_code:
121 description: The status of api request.
122 returned: always
123 type: int
124 sample: 0
125 response_data:
126 description: The api response.
127 type: list
128 returned: always
129 response_message:
130 description: The descriptive message of the api response.
131 type: str
132 returned: always
133 sample: OK.
134 system_information:
135 description: The information of the target system.
136 type: dict
137 returned: always
138 rc:
139 description: The status the request.
140 type: int
141 returned: always
142 sample: 0
143 version_check_warning:
144 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
145 type: list
146 returned: complex
147 '''
148 from ansible.module_utils.basic import AnsibleModule
149 from ansible.module_utils.connection import Connection
150 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
151 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
152
153
154 def main():
155 urls_list = [
156 '/pm/devprof/adom/{adom}'
157 ]
158 module_arg_spec = {
159 'adom': {'required': True, 'type': 'str'},
160 'pm_devprof_adom': {
161 'type': 'dict', 'v_range': [['6.0.0', '']],
162 'options': {
163 'description': {'type': 'str'},
164 'enabled options': {
165 'type': 'list',
166 'choices': ['none', 'dns', 'ntp', 'email', 'admin', 'snmp', 'repmsg', 'ftgd', 'log'],
167 'elements': 'str'
168 },
169 'name': {'type': 'str'},
170 'oid': {'type': 'int'},
171 'scope member': {'type': 'list', 'options': {'name': {'type': 'str'}, 'vdom': {'type': 'str'}}, 'elements': 'dict'},
172 'type': {'choices': ['devprof'], 'type': 'str'}
173 }
174 }
175 }
176
177 module_option_spec = get_module_arg_spec('partial crud')
178 module_arg_spec.update(module_option_spec)
179 check_galaxy_version(module_arg_spec)
180 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'pm_devprof_adom'),
181 supports_check_mode=True)
182 if not module._socket_path:
183 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
184 connection = Connection(module._socket_path)
185 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
186 None, 'data', module, connection)
187 fmgr.process_partial_crud()
188 module.exit_json(meta=module.params)
189
190
191 if __name__ == '__main__':
192 main()