Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_dvmdb_group.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_group
15 short_description: Device group table.
16 version_added: "1.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 dvmdb_group:
26 description: The top level parameters set.
27 required: false
28 type: dict
29 suboptions:
30 desc:
31 type: str
32 description: Desc.
33 meta_fields:
34 aliases: ['meta fields']
35 type: dict
36 description: Default metafields
37 name:
38 type: str
39 description: Name.
40 required: true
41 os_type:
42 type: str
43 description: Os type.
44 choices: ['unknown', 'fos', 'fsw', 'foc', 'fml', 'faz', 'fwb', 'fch', 'fct',
45 'log', 'fmg', 'fsa', 'fdd', 'fac', 'fpx', 'fna', 'fdc', 'ffw', 'fsr',
46 'fad', 'fap', 'fxt', 'fts', 'fai', 'fwc', 'fis', 'fed', 'fpa', 'fca',
47 'ftc', 'fss', 'fra', 'sim']
48 type:
49 type: str
50 description: Type.
51 choices: ['normal', 'default', 'auto', 'cluster', 'fabric']
52 id:
53 type: str
54 description: Id.
55 cluster_type:
56 type: str
57 description: Cluster type.
58 choices: ['unknown', 'vwan', 'sase', 'ums_aws', 'ums_azure', 'ums_gcp']
59 '''
60
61 EXAMPLES = '''
62 - name: Example playbook
63 hosts: fortimanagers
64 gather_facts: false
65 connection: httpapi
66 vars:
67 ansible_httpapi_use_ssl: true
68 ansible_httpapi_validate_certs: false
69 ansible_httpapi_port: 443
70 tasks:
71 - name: Device group table.
72 fortinet.fortimanager.fmgr_dvmdb_group:
73 bypass_validation: false
74 adom: ansible
75 state: present
76 dvmdb_group:
77 desc: "ansible-test"
78 name: "ansible-test"
79 os_type: fos
80 type: normal
81
82 - name: Gathering fortimanager facts
83 hosts: fortimanagers
84 gather_facts: false
85 connection: httpapi
86 vars:
87 ansible_httpapi_use_ssl: true
88 ansible_httpapi_validate_certs: false
89 ansible_httpapi_port: 443
90 tasks:
91 - name: Retrieve all the groups in the device
92 fortinet.fortimanager.fmgr_fact:
93 facts:
94 selector: "dvmdb_group"
95 params:
96 adom: "ansible"
97 group: "your_value"
98 '''
99
100 RETURN = '''
101 meta:
102 description: The result of the request.
103 type: dict
104 returned: always
105 contains:
106 request_url:
107 description: The full url requested.
108 returned: always
109 type: str
110 sample: /sys/login/user
111 response_code:
112 description: The status of api request.
113 returned: always
114 type: int
115 sample: 0
116 response_data:
117 description: The api response.
118 type: list
119 returned: always
120 response_message:
121 description: The descriptive message of the api response.
122 type: str
123 returned: always
124 sample: OK.
125 system_information:
126 description: The information of the target system.
127 type: dict
128 returned: always
129 rc:
130 description: The status the request.
131 type: int
132 returned: always
133 sample: 0
134 version_check_warning:
135 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
136 type: list
137 returned: complex
138 '''
139 from ansible.module_utils.basic import AnsibleModule
140 from ansible.module_utils.connection import Connection
141 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
142 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
143
144
145 def main():
146 urls_list = [
147 '/dvmdb/adom/{adom}/group',
148 '/dvmdb/group'
149 ]
150 module_arg_spec = {
151 'adom': {'required': True, 'type': 'str'},
152 'dvmdb_group': {
153 'type': 'dict', 'v_range': [['6.0.0', '']],
154 'options': {
155 'desc': {'type': 'str'},
156 'meta fields': {'type': 'dict'},
157 'name': {'required': True, 'type': 'str'},
158 'os_type': {
159 'choices': [
160 'unknown', 'fos', 'fsw', 'foc', 'fml', 'faz', 'fwb', 'fch', 'fct', 'log', 'fmg', 'fsa', 'fdd', 'fac', 'fpx', 'fna', 'fdc', 'ffw',
161 'fsr', 'fad', 'fap', 'fxt', 'fts', 'fai', 'fwc', 'fis', 'fed', 'fpa', 'fca', 'ftc', 'fss', 'fra', 'sim'
162 ],
163 'type': 'str'
164 },
165 'type': {'choices': ['normal', 'default', 'auto', 'cluster', 'fabric'], 'type': 'str'},
166 'id': {'v_range': [['7.2.1', '']], 'type': 'str'},
167 'cluster_type': {'v_range': [['7.2.2', '']], 'choices': ['unknown', 'vwan', 'sase', 'ums_aws', 'ums_azure', 'ums_gcp'], 'type': 'str'}
168 }
169 }
170 }
171
172 module_option_spec = get_module_arg_spec('full crud')
173 module_arg_spec.update(module_option_spec)
174 check_galaxy_version(module_arg_spec)
175 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'dvmdb_group'),
176 supports_check_mode=True)
177 if not module._socket_path:
178 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
179 connection = Connection(module._socket_path)
180 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
181 'name', 'data', module, connection)
182 fmgr.process_crud()
183 module.exit_json(meta=module.params)
184
185
186 if __name__ == '__main__':
187 main()