Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_dynamic_multicast_interface.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_dynamic_multicast_interface
15 short_description: Dynamic multicast interface
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 dynamic_multicast_interface:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 default_mapping:
34 aliases: ['default-mapping']
35 type: str
36 description: Default mapping.
37 choices: ['disable', 'enable']
38 defmap_intf:
39 aliases: ['defmap-intf']
40 type: str
41 description: Defmap intf.
42 description:
43 type: str
44 description: Description.
45 dynamic_mapping:
46 type: list
47 elements: dict
48 description: Dynamic mapping.
49 suboptions:
50 _scope:
51 type: list
52 elements: dict
53 description: Scope.
54 suboptions:
55 name:
56 type: str
57 description: Name.
58 vdom:
59 type: str
60 description: Vdom.
61 local_intf:
62 aliases: ['local-intf']
63 type: str
64 description: Local intf.
65 name:
66 type: str
67 description: Name.
68 required: true
69 zone_only:
70 aliases: ['zone-only']
71 type: str
72 description: Zone only.
73 choices: ['disable', 'enable']
74 '''
75
76 EXAMPLES = '''
77 - name: Example playbook (generated based on argument schema)
78 hosts: fortimanagers
79 connection: httpapi
80 gather_facts: false
81 tasks:
82 - name: Dynamic multicast interface
83 fortinet.fortimanager.fmgr_dynamic_multicast_interface:
84 # workspace_locking_adom: <global or your adom name>
85 adom: <your own value>
86 state: present # <value in [present, absent]>
87 dynamic_multicast_interface:
88 name: "your value" # Required variable, string
89 # default_mapping: <value in [disable, enable]>
90 # defmap_intf: <string>
91 # description: <string>
92 # dynamic_mapping:
93 # - _scope:
94 # - name: <string>
95 # vdom: <string>
96 # local_intf: <string>
97 # zone_only: <value in [disable, enable]>
98 '''
99
100 RETURN = '''
101 meta:
102 description: The result of the request.
103 type: dict
104 returned: always
105 contains:
106 request_url:
107 description: The full url requested.
108 returned: always
109 type: str
110 sample: /sys/login/user
111 response_code:
112 description: The status of api request.
113 returned: always
114 type: int
115 sample: 0
116 response_data:
117 description: The api response.
118 type: list
119 returned: always
120 response_message:
121 description: The descriptive message of the api response.
122 type: str
123 returned: always
124 sample: OK.
125 system_information:
126 description: The information of the target system.
127 type: dict
128 returned: always
129 rc:
130 description: The status the request.
131 type: int
132 returned: always
133 sample: 0
134 version_check_warning:
135 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
136 type: list
137 returned: complex
138 '''
139 from ansible.module_utils.basic import AnsibleModule
140 from ansible.module_utils.connection import Connection
141 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
142 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
143
144
145 def main():
146 urls_list = [
147 '/pm/config/adom/{adom}/obj/dynamic/multicast/interface',
148 '/pm/config/global/obj/dynamic/multicast/interface'
149 ]
150 module_arg_spec = {
151 'adom': {'required': True, 'type': 'str'},
152 'revision_note': {'type': 'str'},
153 'dynamic_multicast_interface': {
154 'type': 'dict', 'v_range': [['6.0.0', '']],
155 'options': {
156 'default-mapping': {'choices': ['disable', 'enable'], 'type': 'str'},
157 'defmap-intf': {'type': 'str'},
158 'description': {'type': 'str'},
159 'dynamic_mapping': {
160 'type': 'list',
161 'options': {
162 '_scope': {'type': 'list', 'options': {'name': {'type': 'str'}, 'vdom': {'type': 'str'}}, 'elements': 'dict'},
163 'local-intf': {'type': 'str'}
164 },
165 'elements': 'dict'
166 },
167 'name': {'required': True, 'type': 'str'},
168 'zone-only': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
169 }
170 }
171 }
172
173 module_option_spec = get_module_arg_spec('full crud')
174 module_arg_spec.update(module_option_spec)
175 check_galaxy_version(module_arg_spec)
176 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'dynamic_multicast_interface'),
177 supports_check_mode=True)
178 if not module._socket_path:
179 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
180 connection = Connection(module._socket_path)
181 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
182 'name', 'data', module, connection)
183 fmgr.process_crud()
184 module.exit_json(meta=module.params)
185
186
187 if __name__ == '__main__':
188 main()