Debian Codegraph @

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