Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_extendercontroller_simprofile_autoswitchprofile.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_simprofile_autoswitchprofile
15 short_description: Extender controller sim profile auto switch profile
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_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 sim_profile:
29 description: The parameter (sim_profile) in requested url.
30 type: str
31 required: true
32 extendercontroller_simprofile_autoswitchprofile:
33 description: The top level parameters set.
34 required: false
35 type: dict
36 suboptions:
37 dataplan:
38 type: str
39 description: Dataplan.
40 choices: ['disable', 'enable']
41 disconnect:
42 type: str
43 description: Disconnect.
44 choices: ['disable', 'enable']
45 disconnect_period:
46 aliases: ['disconnect-period']
47 type: int
48 description: Disconnect period.
49 disconnect_threshold:
50 aliases: ['disconnect-threshold']
51 type: int
52 description: Disconnect threshold.
53 signal:
54 type: str
55 description: Signal.
56 choices: ['disable', 'enable']
57 status:
58 type: str
59 description: Status.
60 choices: ['disable', 'enable']
61 switch_back:
62 aliases: ['switch-back']
63 type: list
64 elements: str
65 description: Switch back.
66 choices: ['time', 'timer']
67 switch_back_time:
68 aliases: ['switch-back-time']
69 type: str
70 description: Switch back time.
71 switch_back_timer:
72 aliases: ['switch-back-timer']
73 type: int
74 description: Switch back timer.
75 '''
76
77 EXAMPLES = '''
78 - name: Example playbook (generated based on argument schema)
79 hosts: fortimanagers
80 connection: httpapi
81 gather_facts: false
82 tasks:
83 - name: Extender controller sim profile auto switch profile
84 fortinet.fortimanager.fmgr_extendercontroller_simprofile_autoswitchprofile:
85 # workspace_locking_adom: <global or your adom name>
86 adom: <your own value>
87 sim_profile: <your own value>
88 extendercontroller_simprofile_autoswitchprofile:
89 # dataplan: <value in [disable, enable]>
90 # disconnect: <value in [disable, enable]>
91 # disconnect_period: <integer>
92 # disconnect_threshold: <integer>
93 # signal: <value in [disable, enable]>
94 # status: <value in [disable, enable]>
95 # switch_back: ["time", "timer"]
96 # switch_back_time: <string>
97 # switch_back_timer: <integer>
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/extender-controller/sim_profile/{sim_profile}/auto-switch_profile',
148 '/pm/config/global/obj/extender-controller/sim_profile/{sim_profile}/auto-switch_profile'
149 ]
150 module_arg_spec = {
151 'adom': {'required': True, 'type': 'str'},
152 'sim_profile': {'required': True, 'type': 'str'},
153 'revision_note': {'type': 'str'},
154 'extendercontroller_simprofile_autoswitchprofile': {
155 'type': 'dict', 'v_range': [['6.4.4', '']],
156 'options': {
157 'dataplan': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
158 'disconnect': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
159 'disconnect-period': {'v_range': [['6.4.4', '']], 'type': 'int'},
160 'disconnect-threshold': {'v_range': [['6.4.4', '']], 'type': 'int'},
161 'signal': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
162 'status': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
163 'switch-back': {'v_range': [['6.4.4', '']], 'type': 'list', 'choices': ['time', 'timer'], 'elements': 'str'},
164 'switch-back-time': {'v_range': [['6.4.4', '']], 'type': 'str'},
165 'switch-back-timer': {'v_range': [['6.4.4', '']], 'type': 'int'}
166 }
167 }
168 }
169
170 module_option_spec = get_module_arg_spec('partial crud')
171 module_arg_spec.update(module_option_spec)
172 check_galaxy_version(module_arg_spec)
173 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'extendercontroller_simprofile_autoswitchprofile'),
174 supports_check_mode=True)
175 if not module._socket_path:
176 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
177 connection = Connection(module._socket_path)
178 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
179 None, 'data', module, connection)
180 fmgr.process_partial_crud()
181 module.exit_json(meta=module.params)
182
183
184 if __name__ == '__main__':
185 main()