Debian Codegraph @

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