Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_replacemsggroup_mm3.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_mm3
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_mm3:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 add_html:
40 aliases: ['add-html']
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 format:
49 type: str
50 description: Format flag.
51 choices: ['none', 'text', 'html', 'wml']
52 from:
53 type: str
54 description: From address
55 from_sender:
56 aliases: ['from-sender']
57 type: str
58 description: Notification message sent from recipient
59 choices: ['disable', 'enable']
60 header:
61 type: str
62 description: Header flag.
63 choices: ['none', 'http', '8bit']
64 html_part:
65 aliases: ['html-part']
66 type: str
67 description: Message encapsulation text
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 subject:
84 type: str
85 description: Subject text string
86 '''
87
88 EXAMPLES = '''
89 - name: Example playbook (generated based on argument schema)
90 hosts: fortimanagers
91 connection: httpapi
92 gather_facts: false
93 tasks:
94 - name: Replacement message table entries.
95 fortinet.fortimanager.fmgr_system_replacemsggroup_mm3:
96 # workspace_locking_adom: <global or your adom name>
97 adom: <your own value>
98 replacemsg_group: <your own value>
99 state: present # <value in [present, absent]>
100 system_replacemsggroup_mm3:
101 msg_type: "your value" # Required variable, string
102 # add_html: <value in [disable, enable]>
103 # charset: <value in [us-ascii, utf-8]>
104 # format: <value in [none, text, html, ...]>
105 # from: <string>
106 # from_sender: <value in [disable, enable]>
107 # header: <value in [none, http, 8bit]>
108 # html_part: <string>
109 # image: <string>
110 # fmgr_message: <string>
111 # priority: <value in [low, normal, high, ...]>
112 # subject: <string>
113 '''
114
115 RETURN = '''
116 meta:
117 description: The result of the request.
118 type: dict
119 returned: always
120 contains:
121 request_url:
122 description: The full url requested.
123 returned: always
124 type: str
125 sample: /sys/login/user
126 response_code:
127 description: The status of api request.
128 returned: always
129 type: int
130 sample: 0
131 response_data:
132 description: The api response.
133 type: list
134 returned: always
135 response_message:
136 description: The descriptive message of the api response.
137 type: str
138 returned: always
139 sample: OK.
140 system_information:
141 description: The information of the target system.
142 type: dict
143 returned: always
144 rc:
145 description: The status the request.
146 type: int
147 returned: always
148 sample: 0
149 version_check_warning:
150 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
151 type: list
152 returned: complex
153 '''
154 from ansible.module_utils.basic import AnsibleModule
155 from ansible.module_utils.connection import Connection
156 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
157 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
158
159
160 def main():
161 urls_list = [
162 '/pm/config/adom/{adom}/obj/system/replacemsg-group/{replacemsg-group}/mm3',
163 '/pm/config/global/obj/system/replacemsg-group/{replacemsg-group}/mm3'
164 ]
165 module_arg_spec = {
166 'adom': {'required': True, 'type': 'str'},
167 'replacemsg-group': {'type': 'str', 'api_name': 'replacemsg_group'},
168 'replacemsg_group': {'type': 'str'},
169 'revision_note': {'type': 'str'},
170 'system_replacemsggroup_mm3': {
171 'type': 'dict', 'v_range': [['6.0.0', '7.6.2']],
172 'options': {
173 'add-html': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
174 'charset': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['us-ascii', 'utf-8'], 'type': 'str'},
175 'format': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['none', 'text', 'html', 'wml'], 'type': 'str'},
176 'from': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
177 'from-sender': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
178 'header': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['none', 'http', '8bit'], 'type': 'str'},
179 'html-part': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
180 'image': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
181 'fmgr_message': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
182 'msg-type': {'v_range': [['6.0.0', '7.6.2']], 'required': True, 'type': 'str'},
183 'priority': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['low', 'normal', 'high', 'not-included'], 'type': 'str'},
184 'subject': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'}
185 }
186 }
187 }
188
189 module_option_spec = get_module_arg_spec('full crud')
190 module_arg_spec.update(module_option_spec)
191 check_galaxy_version(module_arg_spec)
192 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_replacemsggroup_mm3'),
193 supports_check_mode=True)
194 if not module._socket_path:
195 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
196 connection = Connection(module._socket_path)
197 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
198 'msg-type', 'data', module, connection)
199 fmgr.process_crud()
200 module.exit_json(meta=module.params)
201
202
203 if __name__ == '__main__':
204 main()