Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_replacemsggroup_mms.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_mms
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_mms:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 buffer:
40 type: str
41 description: Message string.
42 charset:
43 type: str
44 description: Character encoding used for replacement message
45 choices: ['us-ascii', 'utf-8']
46 format:
47 type: str
48 description: Format flag.
49 choices: ['none', 'text', 'html', 'wml']
50 header:
51 type: str
52 description: Header flag.
53 choices: ['none', 'http', '8bit']
54 image:
55 type: str
56 description: Message string.
57 msg_type:
58 aliases: ['msg-type']
59 type: str
60 description: Message type.
61 required: true
62 '''
63
64 EXAMPLES = '''
65 - name: Example playbook (generated based on argument schema)
66 hosts: fortimanagers
67 connection: httpapi
68 gather_facts: false
69 tasks:
70 - name: Replacement message table entries.
71 fortinet.fortimanager.fmgr_system_replacemsggroup_mms:
72 # workspace_locking_adom: <global or your adom name>
73 adom: <your own value>
74 replacemsg_group: <your own value>
75 state: present # <value in [present, absent]>
76 system_replacemsggroup_mms:
77 msg_type: "your value" # Required variable, string
78 # buffer: <string>
79 # charset: <value in [us-ascii, utf-8]>
80 # format: <value in [none, text, html, ...]>
81 # header: <value in [none, http, 8bit]>
82 # image: <string>
83 '''
84
85 RETURN = '''
86 meta:
87 description: The result of the request.
88 type: dict
89 returned: always
90 contains:
91 request_url:
92 description: The full url requested.
93 returned: always
94 type: str
95 sample: /sys/login/user
96 response_code:
97 description: The status of api request.
98 returned: always
99 type: int
100 sample: 0
101 response_data:
102 description: The api response.
103 type: list
104 returned: always
105 response_message:
106 description: The descriptive message of the api response.
107 type: str
108 returned: always
109 sample: OK.
110 system_information:
111 description: The information of the target system.
112 type: dict
113 returned: always
114 rc:
115 description: The status the request.
116 type: int
117 returned: always
118 sample: 0
119 version_check_warning:
120 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
121 type: list
122 returned: complex
123 '''
124 from ansible.module_utils.basic import AnsibleModule
125 from ansible.module_utils.connection import Connection
126 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
127 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
128
129
130 def main():
131 urls_list = [
132 '/pm/config/adom/{adom}/obj/system/replacemsg-group/{replacemsg-group}/mms',
133 '/pm/config/global/obj/system/replacemsg-group/{replacemsg-group}/mms'
134 ]
135 module_arg_spec = {
136 'adom': {'required': True, 'type': 'str'},
137 'replacemsg-group': {'type': 'str', 'api_name': 'replacemsg_group'},
138 'replacemsg_group': {'type': 'str'},
139 'revision_note': {'type': 'str'},
140 'system_replacemsggroup_mms': {
141 'type': 'dict', 'v_range': [['6.0.0', '7.6.2']],
142 'options': {
143 'buffer': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
144 'charset': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['us-ascii', 'utf-8'], 'type': 'str'},
145 'format': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['none', 'text', 'html', 'wml'], 'type': 'str'},
146 'header': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['none', 'http', '8bit'], 'type': 'str'},
147 'image': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
148 'msg-type': {'v_range': [['6.0.0', '7.6.2']], 'required': True, 'type': 'str'}
149 }
150 }
151 }
152
153 module_option_spec = get_module_arg_spec('full crud')
154 module_arg_spec.update(module_option_spec)
155 check_galaxy_version(module_arg_spec)
156 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_replacemsggroup_mms'),
157 supports_check_mode=True)
158 if not module._socket_path:
159 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
160 connection = Connection(module._socket_path)
161 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
162 'msg-type', 'data', module, connection)
163 fmgr.process_crud()
164 module.exit_json(meta=module.params)
165
166
167 if __name__ == '__main__':
168 main()