Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_virtualwirepair.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_system_virtualwirepair
15 short_description: Configure virtual wire pairs.
16 version_added: "2.0.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 system_virtualwirepair:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 member:
34 type: list
35 elements: str
36 description: Interfaces belong to the virtual-wire-pair.
37 name:
38 type: str
39 description: Virtual-wire-pair name.
40 required: true
41 vlan_filter:
42 aliases: ['vlan-filter']
43 type: str
44 description: Set VLAN filters.
45 wildcard_vlan:
46 aliases: ['wildcard-vlan']
47 type: str
48 description: Enable/disable wildcard VLAN.
49 choices: ['disable', 'enable']
50 poweron_bypass:
51 aliases: ['poweron-bypass']
52 type: str
53 description: Set interface bypass state in power on
54 choices: ['disable', 'enable']
55 poweroff_bypass:
56 aliases: ['poweroff-bypass']
57 type: str
58 description: Set interface bypass state in power off
59 choices: ['disable', 'enable']
60 outer_vlan_id:
61 aliases: ['outer-vlan-id']
62 type: raw
63 description: (list) Outer VLAN ID.
64 '''
65
66 EXAMPLES = '''
67 - name: Example playbook (generated based on argument schema)
68 hosts: fortimanagers
69 connection: httpapi
70 gather_facts: false
71 tasks:
72 - name: Configure virtual wire pairs.
73 fortinet.fortimanager.fmgr_system_virtualwirepair:
74 # workspace_locking_adom: <global or your adom name>
75 adom: <your own value>
76 state: present # <value in [present, absent]>
77 system_virtualwirepair:
78 name: "your value" # Required variable, string
79 # member: <list or string>
80 # vlan_filter: <string>
81 # wildcard_vlan: <value in [disable, enable]>
82 # poweron_bypass: <value in [disable, enable]>
83 # poweroff_bypass: <value in [disable, enable]>
84 # outer_vlan_id: <list or integer>
85 '''
86
87 RETURN = '''
88 meta:
89 description: The result of the request.
90 type: dict
91 returned: always
92 contains:
93 request_url:
94 description: The full url requested.
95 returned: always
96 type: str
97 sample: /sys/login/user
98 response_code:
99 description: The status of api request.
100 returned: always
101 type: int
102 sample: 0
103 response_data:
104 description: The api response.
105 type: list
106 returned: always
107 response_message:
108 description: The descriptive message of the api response.
109 type: str
110 returned: always
111 sample: OK.
112 system_information:
113 description: The information of the target system.
114 type: dict
115 returned: always
116 rc:
117 description: The status the request.
118 type: int
119 returned: always
120 sample: 0
121 version_check_warning:
122 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
123 type: list
124 returned: complex
125 '''
126 from ansible.module_utils.basic import AnsibleModule
127 from ansible.module_utils.connection import Connection
128 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
129 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
130
131
132 def main():
133 urls_list = [
134 '/pm/config/adom/{adom}/obj/system/virtual-wire-pair',
135 '/pm/config/global/obj/system/virtual-wire-pair'
136 ]
137 module_arg_spec = {
138 'adom': {'required': True, 'type': 'str'},
139 'revision_note': {'type': 'str'},
140 'system_virtualwirepair': {
141 'type': 'dict', 'v_range': [['6.0.0', '']],
142 'options': {
143 'member': {'type': 'list', 'elements': 'str'},
144 'name': {'required': True, 'type': 'str'},
145 'vlan-filter': {'type': 'str'},
146 'wildcard-vlan': {'choices': ['disable', 'enable'], 'type': 'str'},
147 'poweron-bypass': {'v_range': [['6.2.7', '6.2.13'], ['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
148 'poweroff-bypass': {'v_range': [['6.2.7', '6.2.13'], ['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
149 'outer-vlan-id': {'v_range': [['7.2.3', '']], 'type': 'raw'}
150 }
151 }
152 }
153
154 module_option_spec = get_module_arg_spec('full crud')
155 module_arg_spec.update(module_option_spec)
156 check_galaxy_version(module_arg_spec)
157 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_virtualwirepair'),
158 supports_check_mode=True)
159 if not module._socket_path:
160 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
161 connection = Connection(module._socket_path)
162 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
163 'name', 'data', module, connection)
164 fmgr.process_crud()
165 module.exit_json(meta=module.params)
166
167
168 if __name__ == '__main__':
169 main()