Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_replacemsggroup_mm1.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_mm1
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_mm1:
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', 'information', 'automatic', 'not-included']
52 format:
53 type: str
54 description: Format flag.
55 choices: ['none', 'text', 'html', 'wml']
56 from:
57 type: str
58 description: From address
59 from_sender:
60 aliases: ['from-sender']
61 type: str
62 description: Notification message sent from recipient
63 choices: ['disable', 'enable']
64 header:
65 type: str
66 description: Header flag.
67 choices: ['none', 'http', '8bit']
68 image:
69 type: str
70 description: Message string.
71 fmgr_message:
72 type: str
73 description: Message text
74 msg_type:
75 aliases: ['msg-type']
76 type: str
77 description: Message type.
78 required: true
79 priority:
80 type: str
81 description: Message priority
82 choices: ['low', 'normal', 'high', 'not-included']
83 rsp_status:
84 aliases: ['rsp-status']
85 type: str
86 description: Response status code
87 choices: ['ok', 'err-unspecified', 'err-srv-denied', 'err-msg-fmt-corrupt',
88 'err-snd-addr-unresolv', 'err-msg-not-found', 'err-net-prob',
89 'err-content-not-accept', 'err-unsupp-msg']
90 rsp_text:
91 aliases: ['rsp-text']
92 type: str
93 description: Response text
94 sender_visibility:
95 aliases: ['sender-visibility']
96 type: str
97 description: Sender visibility
98 choices: ['hide', 'show', 'not-specified']
99 smil_part:
100 aliases: ['smil-part']
101 type: str
102 description: Message encapsulation text
103 subject:
104 type: str
105 description: Subject text string
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: Replacement message table entries.
115 fortinet.fortimanager.fmgr_system_replacemsggroup_mm1:
116 # workspace_locking_adom: <global or your adom name>
117 adom: <your own value>
118 replacemsg_group: <your own value>
119 state: present # <value in [present, absent]>
120 system_replacemsggroup_mm1:
121 msg_type: "your value" # Required variable, string
122 # add_smil: <value in [disable, enable]>
123 # charset: <value in [us-ascii, utf-8]>
124 # class: <value in [personal, advertisement, information, ...]>
125 # format: <value in [none, text, html, ...]>
126 # from: <string>
127 # from_sender: <value in [disable, enable]>
128 # header: <value in [none, http, 8bit]>
129 # image: <string>
130 # fmgr_message: <string>
131 # priority: <value in [low, normal, high, ...]>
132 # rsp_status: <value in [ok, err-unspecified, err-srv-denied, ...]>
133 # rsp_text: <string>
134 # sender_visibility: <value in [hide, show, not-specified]>
135 # smil_part: <string>
136 # subject: <string>
137 '''
138
139 RETURN = '''
140 meta:
141 description: The result of the request.
142 type: dict
143 returned: always
144 contains:
145 request_url:
146 description: The full url requested.
147 returned: always
148 type: str
149 sample: /sys/login/user
150 response_code:
151 description: The status of api request.
152 returned: always
153 type: int
154 sample: 0
155 response_data:
156 description: The api response.
157 type: list
158 returned: always
159 response_message:
160 description: The descriptive message of the api response.
161 type: str
162 returned: always
163 sample: OK.
164 system_information:
165 description: The information of the target system.
166 type: dict
167 returned: always
168 rc:
169 description: The status the request.
170 type: int
171 returned: always
172 sample: 0
173 version_check_warning:
174 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
175 type: list
176 returned: complex
177 '''
178 from ansible.module_utils.basic import AnsibleModule
179 from ansible.module_utils.connection import Connection
180 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
181 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
182
183
184 def main():
185 urls_list = [
186 '/pm/config/adom/{adom}/obj/system/replacemsg-group/{replacemsg-group}/mm1',
187 '/pm/config/global/obj/system/replacemsg-group/{replacemsg-group}/mm1'
188 ]
189 module_arg_spec = {
190 'adom': {'required': True, 'type': 'str'},
191 'replacemsg-group': {'type': 'str', 'api_name': 'replacemsg_group'},
192 'replacemsg_group': {'type': 'str'},
193 'revision_note': {'type': 'str'},
194 'system_replacemsggroup_mm1': {
195 'type': 'dict', 'v_range': [['6.0.0', '7.6.2']],
196 'options': {
197 'add-smil': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
198 'charset': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['us-ascii', 'utf-8'], 'type': 'str'},
199 'class': {
200 'v_range': [['6.0.0', '7.6.2']],
201 'choices': ['personal', 'advertisement', 'information', 'automatic', 'not-included'],
202 'type': 'str'
203 },
204 'format': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['none', 'text', 'html', 'wml'], 'type': 'str'},
205 'from': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
206 'from-sender': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
207 'header': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['none', 'http', '8bit'], 'type': 'str'},
208 'image': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
209 'fmgr_message': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
210 'msg-type': {'v_range': [['6.0.0', '7.6.2']], 'required': True, 'type': 'str'},
211 'priority': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['low', 'normal', 'high', 'not-included'], 'type': 'str'},
212 'rsp-status': {
213 'v_range': [['6.0.0', '7.6.2']],
214 'choices': [
215 'ok', 'err-unspecified', 'err-srv-denied', 'err-msg-fmt-corrupt', 'err-snd-addr-unresolv', 'err-msg-not-found', 'err-net-prob',
216 'err-content-not-accept', 'err-unsupp-msg'
217 ],
218 'type': 'str'
219 },
220 'rsp-text': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
221 'sender-visibility': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['hide', 'show', 'not-specified'], 'type': 'str'},
222 'smil-part': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
223 'subject': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'}
224 }
225 }
226 }
227
228 module_option_spec = get_module_arg_spec('full crud')
229 module_arg_spec.update(module_option_spec)
230 check_galaxy_version(module_arg_spec)
231 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_replacemsggroup_mm1'),
232 supports_check_mode=True)
233 if not module._socket_path:
234 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
235 connection = Connection(module._socket_path)
236 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
237 'msg-type', 'data', module, connection)
238 fmgr.process_crud()
239 module.exit_json(meta=module.params)
240
241
242 if __name__ == '__main__':
243 main()