Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_wireless_addrgrp.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_wireless_addrgrp
15 short_description: Configure the MAC address group.
16 version_added: "2.2.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 wireless_addrgrp:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 addresses:
34 type: raw
35 description: (list or str) Manually selected group of addresses.
36 default_policy:
37 aliases: ['default-policy']
38 type: str
39 description: Allow or block the clients with MAC addresses that are not in the group.
40 choices: ['deny', 'allow']
41 id:
42 type: str
43 description: ID.
44 required: true
45 '''
46
47 EXAMPLES = '''
48 - name: Example playbook (generated based on argument schema)
49 hosts: fortimanagers
50 connection: httpapi
51 gather_facts: false
52 tasks:
53 - name: Configure the MAC address group.
54 fortinet.fortimanager.fmgr_wireless_addrgrp:
55 # workspace_locking_adom: <global or your adom name>
56 adom: <your own value>
57 state: present # <value in [present, absent]>
58 wireless_addrgrp:
59 id: "your value" # Required variable, string
60 # addresses: <list or string>
61 # default_policy: <value in [deny, allow]>
62 '''
63
64 RETURN = '''
65 meta:
66 description: The result of the request.
67 type: dict
68 returned: always
69 contains:
70 request_url:
71 description: The full url requested.
72 returned: always
73 type: str
74 sample: /sys/login/user
75 response_code:
76 description: The status of api request.
77 returned: always
78 type: int
79 sample: 0
80 response_data:
81 description: The api response.
82 type: list
83 returned: always
84 response_message:
85 description: The descriptive message of the api response.
86 type: str
87 returned: always
88 sample: OK.
89 system_information:
90 description: The information of the target system.
91 type: dict
92 returned: always
93 rc:
94 description: The status the request.
95 type: int
96 returned: always
97 sample: 0
98 version_check_warning:
99 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
100 type: list
101 returned: complex
102 '''
103 from ansible.module_utils.basic import AnsibleModule
104 from ansible.module_utils.connection import Connection
105 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
106 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
107
108
109 def main():
110 urls_list = [
111 '/pm/config/adom/{adom}/obj/wireless-controller/addrgrp',
112 '/pm/config/global/obj/wireless-controller/addrgrp'
113 ]
114 module_arg_spec = {
115 'adom': {'required': True, 'type': 'str'},
116 'revision_note': {'type': 'str'},
117 'wireless_addrgrp': {
118 'type': 'dict', 'v_range': [['7.0.1', '']],
119 'options': {
120 'addresses': {'v_range': [['7.0.1', '']], 'type': 'raw'},
121 'default-policy': {'v_range': [['7.0.1', '']], 'choices': ['deny', 'allow'], 'type': 'str'},
122 'id': {'v_range': [['7.0.1', '']], 'required': True, 'type': 'str'}
123 }
124 }
125 }
126
127 module_option_spec = get_module_arg_spec('full crud')
128 module_arg_spec.update(module_option_spec)
129 check_galaxy_version(module_arg_spec)
130 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'wireless_addrgrp'),
131 supports_check_mode=True)
132 if not module._socket_path:
133 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
134 connection = Connection(module._socket_path)
135 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
136 'id', 'data', module, connection)
137 fmgr.process_crud()
138 module.exit_json(meta=module.params)
139
140
141 if __name__ == '__main__':
142 main()