Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_alertemail.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_alertemail
15 short_description: Configure alertemail.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_alertemail:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 authentication:
27 type: str
28 description:
29 - Enable/disable authentication.
30 - disable - Disable setting.
31 - enable - Enable setting.
32 choices: ['disable', 'enable']
33 fromaddress:
34 type: str
35 description: SMTP from address.
36 fromname:
37 type: str
38 description: SMTP from user.
39 smtppassword:
40 type: raw
41 description: (list) SMTP server password.
42 smtpport:
43 type: int
44 description: SMTP server port.
45 smtpserver:
46 type: str
47 description: SMTP server address.
48 smtpuser:
49 type: str
50 description: SMTP server user.
51 '''
52
53 EXAMPLES = '''
54 - name: Example playbook (generated based on argument schema)
55 hosts: fortimanagers
56 connection: httpapi
57 gather_facts: false
58 tasks:
59 - name: Configure alertemail.
60 fortinet.fortimanager.fmgr_system_alertemail:
61 # workspace_locking_adom: <global or your adom name>
62 system_alertemail:
63 # authentication: <value in [disable, enable]>
64 # fromaddress: <string>
65 # fromname: <string>
66 # smtppassword: <list or string>
67 # smtpport: <integer>
68 # smtpserver: <string>
69 # smtpuser: <string>
70 '''
71
72 RETURN = '''
73 meta:
74 description: The result of the request.
75 type: dict
76 returned: always
77 contains:
78 request_url:
79 description: The full url requested.
80 returned: always
81 type: str
82 sample: /sys/login/user
83 response_code:
84 description: The status of api request.
85 returned: always
86 type: int
87 sample: 0
88 response_data:
89 description: The api response.
90 type: list
91 returned: always
92 response_message:
93 description: The descriptive message of the api response.
94 type: str
95 returned: always
96 sample: OK.
97 system_information:
98 description: The information of the target system.
99 type: dict
100 returned: always
101 rc:
102 description: The status the request.
103 type: int
104 returned: always
105 sample: 0
106 version_check_warning:
107 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
108 type: list
109 returned: complex
110 '''
111 from ansible.module_utils.basic import AnsibleModule
112 from ansible.module_utils.connection import Connection
113 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
114 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
115
116
117 def main():
118 urls_list = [
119 '/cli/global/system/alertemail'
120 ]
121 module_arg_spec = {
122 'system_alertemail': {
123 'type': 'dict', 'v_range': [['6.0.0', '']],
124 'options': {
125 'authentication': {'choices': ['disable', 'enable'], 'type': 'str'},
126 'fromaddress': {'type': 'str'},
127 'fromname': {'type': 'str'},
128 'smtppassword': {'no_log': True, 'type': 'raw'},
129 'smtpport': {'type': 'int'},
130 'smtpserver': {'type': 'str'},
131 'smtpuser': {'type': 'str'}
132 }
133 }
134 }
135
136 module_option_spec = get_module_arg_spec('partial crud')
137 module_arg_spec.update(module_option_spec)
138 check_galaxy_version(module_arg_spec)
139 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_alertemail'),
140 supports_check_mode=True)
141 if not module._socket_path:
142 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
143 connection = Connection(module._socket_path)
144 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
145 None, 'data', module, connection)
146 fmgr.process_partial_crud()
147 module.exit_json(meta=module.params)
148
149
150 if __name__ == '__main__':
151 main()