Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_extendercontroller_dataplan.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_extendercontroller_dataplan
15 short_description: FortiExtender dataplan configuration.
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 extendercontroller_dataplan:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 apn:
34 type: str
35 description: APN configuration.
36 auth_type:
37 aliases: ['auth-type']
38 type: str
39 description: Authentication type.
40 choices: ['none', 'pap', 'chap']
41 billing_date:
42 aliases: ['billing-date']
43 type: int
44 description: Billing day of the month
45 capacity:
46 type: int
47 description: Capacity in MB
48 carrier:
49 type: str
50 description: Carrier configuration.
51 iccid:
52 type: str
53 description: ICCID configuration.
54 modem_id:
55 aliases: ['modem-id']
56 type: str
57 description: Dataplans modem specifics, if any.
58 choices: ['all', 'modem1', 'modem2']
59 monthly_fee:
60 aliases: ['monthly-fee']
61 type: int
62 description: Monthly fee of dataplan
63 name:
64 type: str
65 description: FortiExtender dataplan name
66 required: true
67 overage:
68 type: str
69 description: Enable/disable dataplan overage detection.
70 choices: ['disable', 'enable']
71 password:
72 type: raw
73 description: (list) Password.
74 pdn:
75 type: str
76 description: PDN type.
77 choices: ['ipv4-only', 'ipv6-only', 'ipv4-ipv6']
78 preferred_subnet:
79 aliases: ['preferred-subnet']
80 type: int
81 description: Preferred subnet mask
82 private_network:
83 aliases: ['private-network']
84 type: str
85 description: Enable/disable dataplan private network support.
86 choices: ['disable', 'enable']
87 signal_period:
88 aliases: ['signal-period']
89 type: int
90 description: Signal period
91 signal_threshold:
92 aliases: ['signal-threshold']
93 type: int
94 description: Signal threshold.
95 slot:
96 type: str
97 description: SIM slot configuration.
98 choices: ['sim1', 'sim2']
99 status:
100 type: str
101 description: FortiExtender dataplan
102 choices: ['disable', 'enable']
103 type:
104 type: str
105 description: Type preferences configuration.
106 choices: ['carrier', 'slot', 'iccid', 'generic']
107 username:
108 type: str
109 description: Username.
110 '''
111
112 EXAMPLES = '''
113 - name: Example playbook (generated based on argument schema)
114 hosts: fortimanagers
115 connection: httpapi
116 gather_facts: false
117 tasks:
118 - name: FortiExtender dataplan configuration.
119 fortinet.fortimanager.fmgr_extendercontroller_dataplan:
120 # workspace_locking_adom: <global or your adom name>
121 adom: <your own value>
122 state: present # <value in [present, absent]>
123 extendercontroller_dataplan:
124 name: "your value" # Required variable, string
125 # apn: <string>
126 # auth_type: <value in [none, pap, chap]>
127 # billing_date: <integer>
128 # capacity: <integer>
129 # carrier: <string>
130 # iccid: <string>
131 # modem_id: <value in [all, modem1, modem2]>
132 # monthly_fee: <integer>
133 # overage: <value in [disable, enable]>
134 # password: <list or string>
135 # pdn: <value in [ipv4-only, ipv6-only, ipv4-ipv6]>
136 # preferred_subnet: <integer>
137 # private_network: <value in [disable, enable]>
138 # signal_period: <integer>
139 # signal_threshold: <integer>
140 # slot: <value in [sim1, sim2]>
141 # status: <value in [disable, enable]>
142 # type: <value in [carrier, slot, iccid, ...]>
143 # username: <string>
144 '''
145
146 RETURN = '''
147 meta:
148 description: The result of the request.
149 type: dict
150 returned: always
151 contains:
152 request_url:
153 description: The full url requested.
154 returned: always
155 type: str
156 sample: /sys/login/user
157 response_code:
158 description: The status of api request.
159 returned: always
160 type: int
161 sample: 0
162 response_data:
163 description: The api response.
164 type: list
165 returned: always
166 response_message:
167 description: The descriptive message of the api response.
168 type: str
169 returned: always
170 sample: OK.
171 system_information:
172 description: The information of the target system.
173 type: dict
174 returned: always
175 rc:
176 description: The status the request.
177 type: int
178 returned: always
179 sample: 0
180 version_check_warning:
181 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
182 type: list
183 returned: complex
184 '''
185 from ansible.module_utils.basic import AnsibleModule
186 from ansible.module_utils.connection import Connection
187 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
188 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
189
190
191 def main():
192 urls_list = [
193 '/pm/config/adom/{adom}/obj/extender-controller/dataplan',
194 '/pm/config/global/obj/extender-controller/dataplan'
195 ]
196 module_arg_spec = {
197 'adom': {'required': True, 'type': 'str'},
198 'revision_note': {'type': 'str'},
199 'extendercontroller_dataplan': {
200 'type': 'dict', 'v_range': [['6.4.4', '']],
201 'options': {
202 'apn': {'v_range': [['6.4.4', '']], 'type': 'str'},
203 'auth-type': {'v_range': [['6.4.4', '']], 'choices': ['none', 'pap', 'chap'], 'type': 'str'},
204 'billing-date': {'v_range': [['6.4.4', '']], 'type': 'int'},
205 'capacity': {'v_range': [['6.4.4', '']], 'type': 'int'},
206 'carrier': {'v_range': [['6.4.4', '']], 'type': 'str'},
207 'iccid': {'v_range': [['6.4.4', '']], 'type': 'str'},
208 'modem-id': {'v_range': [['6.4.4', '']], 'choices': ['all', 'modem1', 'modem2'], 'type': 'str'},
209 'monthly-fee': {'v_range': [['6.4.4', '']], 'type': 'int'},
210 'name': {'v_range': [['6.4.4', '']], 'required': True, 'type': 'str'},
211 'overage': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
212 'password': {'v_range': [['6.4.4', '']], 'no_log': True, 'type': 'raw'},
213 'pdn': {'v_range': [['6.4.4', '']], 'choices': ['ipv4-only', 'ipv6-only', 'ipv4-ipv6'], 'type': 'str'},
214 'preferred-subnet': {'v_range': [['6.4.4', '']], 'type': 'int'},
215 'private-network': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
216 'signal-period': {'v_range': [['6.4.4', '']], 'type': 'int'},
217 'signal-threshold': {'v_range': [['6.4.4', '']], 'type': 'int'},
218 'slot': {'v_range': [['6.4.4', '']], 'choices': ['sim1', 'sim2'], 'type': 'str'},
219 'status': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
220 'type': {'v_range': [['6.4.4', '']], 'choices': ['carrier', 'slot', 'iccid', 'generic'], 'type': 'str'},
221 'username': {'v_range': [['6.4.4', '']], 'type': 'str'}
222 }
223 }
224 }
225
226 module_option_spec = get_module_arg_spec('full crud')
227 module_arg_spec.update(module_option_spec)
228 check_galaxy_version(module_arg_spec)
229 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'extendercontroller_dataplan'),
230 supports_check_mode=True)
231 if not module._socket_path:
232 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
233 connection = Connection(module._socket_path)
234 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
235 'name', 'data', module, connection)
236 fmgr.process_crud()
237 module.exit_json(meta=module.params)
238
239
240 if __name__ == '__main__':
241 main()