Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_wagprofile.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_wagprofile
15 short_description: Configure wireless access gateway
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 wagprofile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 comment:
34 type: str
35 description: Comment.
36 dhcp_ip_addr:
37 aliases: ['dhcp-ip-addr']
38 type: str
39 description: IP address of the monitoring DHCP request packet sent through the tunnel.
40 name:
41 type: str
42 description: Tunnel profile name.
43 required: true
44 ping_interval:
45 aliases: ['ping-interval']
46 type: int
47 description: Interval between two tunnel monitoring echo packets
48 ping_number:
49 aliases: ['ping-number']
50 type: int
51 description: Number of the tunnel monitoring echo packets
52 return_packet_timeout:
53 aliases: ['return-packet-timeout']
54 type: int
55 description: Window of time for the return packets from the tunnels remote end
56 tunnel_type:
57 aliases: ['tunnel-type']
58 type: str
59 description: Tunnel type.
60 choices: ['gre', 'l2tpv3']
61 wag_ip:
62 aliases: ['wag-ip']
63 type: str
64 description: IP Address of the wireless access gateway.
65 wag_port:
66 aliases: ['wag-port']
67 type: int
68 description: UDP port of the wireless access gateway.
69 '''
70
71 EXAMPLES = '''
72 - name: Example playbook (generated based on argument schema)
73 hosts: fortimanagers
74 connection: httpapi
75 gather_facts: false
76 tasks:
77 - name: Configure wireless access gateway
78 fortinet.fortimanager.fmgr_wagprofile:
79 # workspace_locking_adom: <global or your adom name>
80 adom: <your own value>
81 state: present # <value in [present, absent]>
82 wagprofile:
83 name: "your value" # Required variable, string
84 # comment: <string>
85 # dhcp_ip_addr: <string>
86 # ping_interval: <integer>
87 # ping_number: <integer>
88 # return_packet_timeout: <integer>
89 # tunnel_type: <value in [gre, l2tpv3]>
90 # wag_ip: <string>
91 # wag_port: <integer>
92 '''
93
94 RETURN = '''
95 meta:
96 description: The result of the request.
97 type: dict
98 returned: always
99 contains:
100 request_url:
101 description: The full url requested.
102 returned: always
103 type: str
104 sample: /sys/login/user
105 response_code:
106 description: The status of api request.
107 returned: always
108 type: int
109 sample: 0
110 response_data:
111 description: The api response.
112 type: list
113 returned: always
114 response_message:
115 description: The descriptive message of the api response.
116 type: str
117 returned: always
118 sample: OK.
119 system_information:
120 description: The information of the target system.
121 type: dict
122 returned: always
123 rc:
124 description: The status the request.
125 type: int
126 returned: always
127 sample: 0
128 version_check_warning:
129 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
130 type: list
131 returned: complex
132 '''
133 from ansible.module_utils.basic import AnsibleModule
134 from ansible.module_utils.connection import Connection
135 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
136 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
137
138
139 def main():
140 urls_list = [
141 '/pm/config/adom/{adom}/obj/wireless-controller/wag-profile',
142 '/pm/config/global/obj/wireless-controller/wag-profile'
143 ]
144 module_arg_spec = {
145 'adom': {'required': True, 'type': 'str'},
146 'revision_note': {'type': 'str'},
147 'wagprofile': {
148 'type': 'dict', 'v_range': [['6.2.3', '']],
149 'options': {
150 'comment': {'v_range': [['6.2.3', '']], 'type': 'str'},
151 'dhcp-ip-addr': {'v_range': [['6.2.3', '']], 'type': 'str'},
152 'name': {'v_range': [['6.2.3', '']], 'required': True, 'type': 'str'},
153 'ping-interval': {'v_range': [['6.2.3', '']], 'type': 'int'},
154 'ping-number': {'v_range': [['6.2.3', '']], 'type': 'int'},
155 'return-packet-timeout': {'v_range': [['6.2.3', '']], 'type': 'int'},
156 'tunnel-type': {'v_range': [['6.2.3', '']], 'choices': ['gre', 'l2tpv3'], 'type': 'str'},
157 'wag-ip': {'v_range': [['6.2.3', '']], 'type': 'str'},
158 'wag-port': {'v_range': [['6.2.3', '']], 'type': 'int'}
159 }
160 }
161 }
162
163 module_option_spec = get_module_arg_spec('full crud')
164 module_arg_spec.update(module_option_spec)
165 check_galaxy_version(module_arg_spec)
166 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'wagprofile'),
167 supports_check_mode=True)
168 if not module._socket_path:
169 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
170 connection = Connection(module._socket_path)
171 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
172 'name', 'data', module, connection)
173 fmgr.process_crud()
174 module.exit_json(meta=module.params)
175
176
177 if __name__ == '__main__':
178 main()