Debian Codegraph @

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