Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_replacemsggroup_mm4.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_system_replacemsggroup_mm4
15 short_description: Replacement message table entries.
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 replacemsg-group:
29 description: Deprecated, please use "replacemsg_group"
30 type: str
31 replacemsg_group:
32 description: The parameter (replacemsg-group) in requested url.
33 type: str
34 system_replacemsggroup_mm4:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 add_smil:
40 aliases: ['add-smil']
41 type: str
42 description: Add message encapsulation
43 choices: ['disable', 'enable']
44 charset:
45 type: str
46 description: Character encoding used for replacement message
47 choices: ['us-ascii', 'utf-8']
48 class:
49 type: str
50 description: Message class
51 choices: ['personal', 'advertisement', 'informational', 'auto', 'not-included']
52 domain:
53 type: str
54 description: From address domain
55 format:
56 type: str
57 description: Format flag.
58 choices: ['none', 'text', 'html', 'wml']
59 from:
60 type: str
61 description: From address
62 from_sender:
63 aliases: ['from-sender']
64 type: str
65 description: Notification message sent from recipient
66 choices: ['disable', 'enable']
67 header:
68 type: str
69 description: Header flag.
70 choices: ['none', 'http', '8bit']
71 image:
72 type: str
73 description: Message string.
74 fmgr_message:
75 type: str
76 description: Message text
77 msg_type:
78 aliases: ['msg-type']
79 type: str
80 description: Message type.
81 required: true
82 priority:
83 type: str
84 description: Message priority
85 choices: ['low', 'normal', 'high', 'not-included']
86 rsp_status:
87 aliases: ['rsp-status']
88 type: str
89 description: Response status
90 choices: ['ok', 'err-unspecified', 'err-srv-denied', 'err-msg-fmt-corrupt',
91 'err-snd-addr-unresolv', 'err-net-prob', 'err-content-not-accept',
92 'err-unsupp-msg']
93 smil_part:
94 aliases: ['smil-part']
95 type: str
96 description: Message encapsulation text
97 subject:
98 type: str
99 description: Subject text string
100 '''
101
102 EXAMPLES = '''
103 - name: Example playbook (generated based on argument schema)
104 hosts: fortimanagers
105 connection: httpapi
106 gather_facts: false
107 tasks:
108 - name: Replacement message table entries.
109 fortinet.fortimanager.fmgr_system_replacemsggroup_mm4:
110 # workspace_locking_adom: <global or your adom name>
111 adom: <your own value>
112 replacemsg_group: <your own value>
113 state: present # <value in [present, absent]>
114 system_replacemsggroup_mm4:
115 msg_type: "your value" # Required variable, string
116 # add_smil: <value in [disable, enable]>
117 # charset: <value in [us-ascii, utf-8]>
118 # class: <value in [personal, advertisement, informational, ...]>
119 # domain: <string>
120 # format: <value in [none, text, html, ...]>
121 # from: <string>
122 # from_sender: <value in [disable, enable]>
123 # header: <value in [none, http, 8bit]>
124 # image: <string>
125 # fmgr_message: <string>
126 # priority: <value in [low, normal, high, ...]>
127 # rsp_status: <value in [ok, err-unspecified, err-srv-denied, ...]>
128 # smil_part: <string>
129 # subject: <string>
130 '''
131
132 RETURN = '''
133 meta:
134 description: The result of the request.
135 type: dict
136 returned: always
137 contains:
138 request_url:
139 description: The full url requested.
140 returned: always
141 type: str
142 sample: /sys/login/user
143 response_code:
144 description: The status of api request.
145 returned: always
146 type: int
147 sample: 0
148 response_data:
149 description: The api response.
150 type: list
151 returned: always
152 response_message:
153 description: The descriptive message of the api response.
154 type: str
155 returned: always
156 sample: OK.
157 system_information:
158 description: The information of the target system.
159 type: dict
160 returned: always
161 rc:
162 description: The status the request.
163 type: int
164 returned: always
165 sample: 0
166 version_check_warning:
167 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
168 type: list
169 returned: complex
170 '''
171 from ansible.module_utils.basic import AnsibleModule
172 from ansible.module_utils.connection import Connection
173 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
174 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
175
176
177 def main():
178 urls_list = [
179 '/pm/config/adom/{adom}/obj/system/replacemsg-group/{replacemsg-group}/mm4',
180 '/pm/config/global/obj/system/replacemsg-group/{replacemsg-group}/mm4'
181 ]
182 module_arg_spec = {
183 'adom': {'required': True, 'type': 'str'},
184 'replacemsg-group': {'type': 'str', 'api_name': 'replacemsg_group'},
185 'replacemsg_group': {'type': 'str'},
186 'revision_note': {'type': 'str'},
187 'system_replacemsggroup_mm4': {
188 'type': 'dict', 'v_range': [['6.0.0', '7.6.2']],
189 'options': {
190 'add-smil': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
191 'charset': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['us-ascii', 'utf-8'], 'type': 'str'},
192 'class': {
193 'v_range': [['6.0.0', '7.6.2']],
194 'choices': ['personal', 'advertisement', 'informational', 'auto', 'not-included'],
195 'type': 'str'
196 },
197 'domain': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
198 'format': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['none', 'text', 'html', 'wml'], 'type': 'str'},
199 'from': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
200 'from-sender': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
201 'header': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['none', 'http', '8bit'], 'type': 'str'},
202 'image': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
203 'fmgr_message': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
204 'msg-type': {'v_range': [['6.0.0', '7.6.2']], 'required': True, 'type': 'str'},
205 'priority': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['low', 'normal', 'high', 'not-included'], 'type': 'str'},
206 'rsp-status': {
207 'v_range': [['6.0.0', '7.6.2']],
208 'choices': [
209 'ok', 'err-unspecified', 'err-srv-denied', 'err-msg-fmt-corrupt', 'err-snd-addr-unresolv', 'err-net-prob',
210 'err-content-not-accept', 'err-unsupp-msg'
211 ],
212 'type': 'str'
213 },
214 'smil-part': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
215 'subject': {'v_range': [['6.0.0', '7.6.2']], '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, 'system_replacemsggroup_mm4'),
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 'msg-type', 'data', module, connection)
230 fmgr.process_crud()
231 module.exit_json(meta=module.params)
232
233
234 if __name__ == '__main__':
235 main()