Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_extensioncontroller_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_extensioncontroller_dataplan
15 short_description: FortiExtender dataplan configuration.
16 version_added: "2.2.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 extensioncontroller_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 data plan 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 type:
100 type: str
101 description: Type preferences configuration.
102 choices: ['carrier', 'slot', 'iccid', 'generic']
103 username:
104 type: str
105 description: Username.
106 '''
107
108 EXAMPLES = '''
109 - name: Example playbook (generated based on argument schema)
110 hosts: fortimanagers
111 connection: httpapi
112 gather_facts: false
113 tasks:
114 - name: FortiExtender dataplan configuration.
115 fortinet.fortimanager.fmgr_extensioncontroller_dataplan:
116 # workspace_locking_adom: <global or your adom name>
117 adom: <your own value>
118 state: present # <value in [present, absent]>
119 extensioncontroller_dataplan:
120 name: "your value" # Required variable, string
121 # apn: <string>
122 # auth_type: <value in [none, pap, chap]>
123 # billing_date: <integer>
124 # capacity: <integer>
125 # carrier: <string>
126 # iccid: <string>
127 # modem_id: <value in [all, modem1, modem2]>
128 # monthly_fee: <integer>
129 # overage: <value in [disable, enable]>
130 # password: <list or string>
131 # pdn: <value in [ipv4-only, ipv6-only, ipv4-ipv6]>
132 # preferred_subnet: <integer>
133 # private_network: <value in [disable, enable]>
134 # signal_period: <integer>
135 # signal_threshold: <integer>
136 # slot: <value in [sim1, sim2]>
137 # type: <value in [carrier, slot, iccid, ...]>
138 # username: <string>
139 '''
140
141 RETURN = '''
142 meta:
143 description: The result of the request.
144 type: dict
145 returned: always
146 contains:
147 request_url:
148 description: The full url requested.
149 returned: always
150 type: str
151 sample: /sys/login/user
152 response_code:
153 description: The status of api request.
154 returned: always
155 type: int
156 sample: 0
157 response_data:
158 description: The api response.
159 type: list
160 returned: always
161 response_message:
162 description: The descriptive message of the api response.
163 type: str
164 returned: always
165 sample: OK.
166 system_information:
167 description: The information of the target system.
168 type: dict
169 returned: always
170 rc:
171 description: The status the request.
172 type: int
173 returned: always
174 sample: 0
175 version_check_warning:
176 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
177 type: list
178 returned: complex
179 '''
180 from ansible.module_utils.basic import AnsibleModule
181 from ansible.module_utils.connection import Connection
182 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
183 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
184
185
186 def main():
187 urls_list = [
188 '/pm/config/adom/{adom}/obj/extension-controller/dataplan',
189 '/pm/config/global/obj/extension-controller/dataplan'
190 ]
191 module_arg_spec = {
192 'adom': {'required': True, 'type': 'str'},
193 'revision_note': {'type': 'str'},
194 'extensioncontroller_dataplan': {
195 'type': 'dict', 'v_range': [['7.2.1', '']],
196 'options': {
197 'apn': {'v_range': [['7.2.1', '']], 'type': 'str'},
198 'auth-type': {'v_range': [['7.2.1', '']], 'choices': ['none', 'pap', 'chap'], 'type': 'str'},
199 'billing-date': {'v_range': [['7.2.1', '']], 'type': 'int'},
200 'capacity': {'v_range': [['7.2.1', '']], 'type': 'int'},
201 'carrier': {'v_range': [['7.2.1', '']], 'type': 'str'},
202 'iccid': {'v_range': [['7.2.1', '']], 'type': 'str'},
203 'modem-id': {'v_range': [['7.2.1', '']], 'choices': ['all', 'modem1', 'modem2'], 'type': 'str'},
204 'monthly-fee': {'v_range': [['7.2.1', '']], 'type': 'int'},
205 'name': {'v_range': [['7.2.1', '']], 'required': True, 'type': 'str'},
206 'overage': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
207 'password': {'v_range': [['7.2.1', '']], 'no_log': True, 'type': 'raw'},
208 'pdn': {'v_range': [['7.2.1', '']], 'choices': ['ipv4-only', 'ipv6-only', 'ipv4-ipv6'], 'type': 'str'},
209 'preferred-subnet': {'v_range': [['7.2.1', '']], 'type': 'int'},
210 'private-network': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
211 'signal-period': {'v_range': [['7.2.1', '']], 'type': 'int'},
212 'signal-threshold': {'v_range': [['7.2.1', '']], 'type': 'int'},
213 'slot': {'v_range': [['7.2.1', '']], 'choices': ['sim1', 'sim2'], 'type': 'str'},
214 'type': {'v_range': [['7.2.1', '']], 'choices': ['carrier', 'slot', 'iccid', 'generic'], 'type': 'str'},
215 'username': {'v_range': [['7.2.1', '']], 'type': 'str'}
216 }
217 }
218 }
219
220 module_option_spec = get_module_arg_spec('full crud')
221 module_arg_spec.update(module_option_spec)
222 check_galaxy_version(module_arg_spec)
223 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'extensioncontroller_dataplan'),
224 supports_check_mode=True)
225 if not module._socket_path:
226 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
227 connection = Connection(module._socket_path)
228 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
229 'name', 'data', module, connection)
230 fmgr.process_crud()
231 module.exit_json(meta=module.params)
232
233
234 if __name__ == '__main__':
235 main()