Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_mpskprofile_mpskgroup.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_mpskprofile_mpskgroup
15 short_description: List of multiple PSK groups.
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 mpsk-profile:
29 description: Deprecated, please use "mpsk_profile"
30 type: str
31 mpsk_profile:
32 description: The parameter (mpsk-profile) in requested url.
33 type: str
34 mpskprofile_mpskgroup:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 mpsk_key:
40 aliases: ['mpsk-key']
41 type: list
42 elements: dict
43 description: Mpsk key.
44 suboptions:
45 comment:
46 type: str
47 description: Comment.
48 concurrent_client_limit_type:
49 aliases: ['concurrent-client-limit-type']
50 type: str
51 description: MPSK client limit type options.
52 choices: ['default', 'unlimited', 'specified']
53 concurrent_clients:
54 aliases: ['concurrent-clients']
55 type: int
56 description: Number of clients that can connect using this pre-shared key
57 mac:
58 type: str
59 description: MAC address.
60 mpsk_schedules:
61 aliases: ['mpsk-schedules']
62 type: raw
63 description: (list or str) Firewall schedule for MPSK passphrase.
64 name:
65 type: str
66 description: Pre-shared key name.
67 passphrase:
68 type: raw
69 description: (list) WPA Pre-shared key.
70 pmk:
71 type: raw
72 description: (list) WPA PMK.
73 key_type:
74 aliases: ['key-type']
75 type: str
76 description: Select the type of the key.
77 choices: ['wpa2-personal', 'wpa3-sae']
78 sae_password:
79 aliases: ['sae-password']
80 type: raw
81 description: (list) WPA3 SAE password.
82 sae_pk:
83 aliases: ['sae-pk']
84 type: str
85 description: Enable/disable WPA3 SAE-PK
86 choices: ['disable', 'enable']
87 sae_private_key:
88 aliases: ['sae-private-key']
89 type: str
90 description: Private key used for WPA3 SAE-PK authentication.
91 name:
92 type: str
93 description: MPSK group name.
94 required: true
95 vlan_id:
96 aliases: ['vlan-id']
97 type: int
98 description: Optional VLAN ID.
99 vlan_type:
100 aliases: ['vlan-type']
101 type: str
102 description: MPSK group VLAN options.
103 choices: ['no-vlan', 'fixed-vlan']
104 '''
105
106 EXAMPLES = '''
107 - name: Example playbook (generated based on argument schema)
108 hosts: fortimanagers
109 connection: httpapi
110 gather_facts: false
111 tasks:
112 - name: List of multiple PSK groups.
113 fortinet.fortimanager.fmgr_mpskprofile_mpskgroup:
114 # workspace_locking_adom: <global or your adom name>
115 adom: <your own value>
116 mpsk_profile: <your own value>
117 state: present # <value in [present, absent]>
118 mpskprofile_mpskgroup:
119 name: "your value" # Required variable, string
120 # mpsk_key:
121 # - comment: <string>
122 # concurrent_client_limit_type: <value in [default, unlimited, specified]>
123 # concurrent_clients: <integer>
124 # mac: <string>
125 # mpsk_schedules: <list or string>
126 # name: <string>
127 # passphrase: <list or string>
128 # pmk: <list or string>
129 # key_type: <value in [wpa2-personal, wpa3-sae]>
130 # sae_password: <list or string>
131 # sae_pk: <value in [disable, enable]>
132 # sae_private_key: <string>
133 # vlan_id: <integer>
134 # vlan_type: <value in [no-vlan, fixed-vlan]>
135 '''
136
137 RETURN = '''
138 meta:
139 description: The result of the request.
140 type: dict
141 returned: always
142 contains:
143 request_url:
144 description: The full url requested.
145 returned: always
146 type: str
147 sample: /sys/login/user
148 response_code:
149 description: The status of api request.
150 returned: always
151 type: int
152 sample: 0
153 response_data:
154 description: The api response.
155 type: list
156 returned: always
157 response_message:
158 description: The descriptive message of the api response.
159 type: str
160 returned: always
161 sample: OK.
162 system_information:
163 description: The information of the target system.
164 type: dict
165 returned: always
166 rc:
167 description: The status the request.
168 type: int
169 returned: always
170 sample: 0
171 version_check_warning:
172 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
173 type: list
174 returned: complex
175 '''
176 from ansible.module_utils.basic import AnsibleModule
177 from ansible.module_utils.connection import Connection
178 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
179 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
180
181
182 def main():
183 urls_list = [
184 '/pm/config/adom/{adom}/obj/wireless-controller/mpsk-profile/{mpsk-profile}/mpsk-group',
185 '/pm/config/global/obj/wireless-controller/mpsk-profile/{mpsk-profile}/mpsk-group'
186 ]
187 module_arg_spec = {
188 'adom': {'required': True, 'type': 'str'},
189 'mpsk-profile': {'type': 'str', 'api_name': 'mpsk_profile'},
190 'mpsk_profile': {'type': 'str'},
191 'revision_note': {'type': 'str'},
192 'mpskprofile_mpskgroup': {
193 'type': 'dict', 'v_range': [['6.4.2', '']],
194 'options': {
195 'mpsk-key': {
196 'v_range': [['6.4.2', '']],
197 'no_log': True,
198 'type': 'list',
199 'options': {
200 'comment': {'v_range': [['6.4.2', '']], 'type': 'str'},
201 'concurrent-client-limit-type': {'v_range': [['6.4.2', '']], 'choices': ['default', 'unlimited', 'specified'], 'type': 'str'},
202 'concurrent-clients': {'v_range': [['6.4.2', '']], 'type': 'int'},
203 'mac': {'v_range': [['6.4.2', '']], 'type': 'str'},
204 'mpsk-schedules': {'v_range': [['6.4.2', '']], 'type': 'raw'},
205 'name': {'v_range': [['6.4.2', '']], 'type': 'str'},
206 'passphrase': {'v_range': [['6.4.2', '']], 'no_log': True, 'type': 'raw'},
207 'pmk': {'v_range': [['6.4.2', '']], 'type': 'raw'},
208 'key-type': {'v_range': [['7.4.3', '']], 'choices': ['wpa2-personal', 'wpa3-sae'], 'type': 'str'},
209 'sae-password': {'v_range': [['7.4.3', '']], 'no_log': True, 'type': 'raw'},
210 'sae-pk': {'v_range': [['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
211 'sae-private-key': {'v_range': [['7.4.3', '']], 'no_log': True, 'type': 'str'}
212 },
213 'elements': 'dict'
214 },
215 'name': {'v_range': [['6.4.2', '']], 'required': True, 'type': 'str'},
216 'vlan-id': {'v_range': [['6.4.2', '']], 'type': 'int'},
217 'vlan-type': {'v_range': [['6.4.2', '']], 'choices': ['no-vlan', 'fixed-vlan'], 'type': 'str'}
218 }
219 }
220 }
221
222 module_option_spec = get_module_arg_spec('full crud')
223 module_arg_spec.update(module_option_spec)
224 check_galaxy_version(module_arg_spec)
225 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'mpskprofile_mpskgroup'),
226 supports_check_mode=True)
227 if not module._socket_path:
228 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
229 connection = Connection(module._socket_path)
230 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
231 'name', 'data', module, connection)
232 fmgr.process_crud()
233 module.exit_json(meta=module.params)
234
235
236 if __name__ == '__main__':
237 main()