Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_vap_vlanname.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_vap_vlanname
15 short_description: Table for mapping VLAN name to VLAN ID.
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 vap:
29 description: The parameter (vap) in requested url.
30 type: str
31 required: true
32 vap_vlanname:
33 description: The top level parameters set.
34 required: false
35 type: dict
36 suboptions:
37 name:
38 type: str
39 description: VLAN name.
40 required: true
41 vlan_id:
42 aliases: ['vlan-id']
43 type: int
44 description: VLAN ID.
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: Table for mapping VLAN name to VLAN ID.
54 fortinet.fortimanager.fmgr_vap_vlanname:
55 # workspace_locking_adom: <global or your adom name>
56 adom: <your own value>
57 vap: <your own value>
58 state: present # <value in [present, absent]>
59 vap_vlanname:
60 name: "your value" # Required variable, string
61 # vlan_id: <integer>
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/vap/{vap}/vlan-name',
112 '/pm/config/global/obj/wireless-controller/vap/{vap}/vlan-name'
113 ]
114 module_arg_spec = {
115 'adom': {'required': True, 'type': 'str'},
116 'vap': {'required': True, 'type': 'str'},
117 'revision_note': {'type': 'str'},
118 'vap_vlanname': {
119 'type': 'dict', 'v_range': [['7.0.3', '']],
120 'options': {'name': {'v_range': [['7.0.3', '']], 'required': True, 'type': 'str'}, 'vlan-id': {'v_range': [['7.0.3', '']], 'type': 'int'}}
121 }
122 }
123
124 module_option_spec = get_module_arg_spec('full crud')
125 module_arg_spec.update(module_option_spec)
126 check_galaxy_version(module_arg_spec)
127 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'vap_vlanname'),
128 supports_check_mode=True)
129 if not module._socket_path:
130 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
131 connection = Connection(module._socket_path)
132 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
133 'name', 'data', module, connection)
134 fmgr.process_crud()
135 module.exit_json(meta=module.params)
136
137
138 if __name__ == '__main__':
139 main()