Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_antivirus_mmschecksum_entries.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_antivirus_mmschecksum_entries
15 short_description: modify this MMS content checksum list
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 mms-checksum:
29 description: Deprecated, please use "mms_checksum"
30 type: str
31 mms_checksum:
32 description: The parameter (mms-checksum) in requested url.
33 type: str
34 antivirus_mmschecksum_entries:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 checksum:
40 type: str
41 description: MMS attachment checksum value
42 name:
43 type: str
44 description: Entry name, for administrator reference
45 required: true
46 status:
47 type: str
48 description: Apply this entry during attachment inspection
49 choices: ['disable', 'enable']
50 '''
51
52 EXAMPLES = '''
53 - name: Example playbook
54 hosts: fortimanagers
55 gather_facts: false
56 connection: httpapi
57 vars:
58 ansible_httpapi_use_ssl: true
59 ansible_httpapi_validate_certs: false
60 ansible_httpapi_port: 443
61 tasks:
62 - name: Modify this MMS content checksum list
63 fortinet.fortimanager.fmgr_antivirus_mmschecksum_entries:
64 adom: FortiCarrier
65 mms_checksum: "1" # id
66 state: present
67 antivirus_mmschecksum_entries:
68 checksum: "test_checksum"
69 name: "entries-name"
70 status: enable
71
72 - name: Gathering fortimanager facts
73 hosts: fortimanagers
74 gather_facts: false
75 connection: httpapi
76 vars:
77 ansible_httpapi_use_ssl: true
78 ansible_httpapi_validate_certs: false
79 ansible_httpapi_port: 443
80 tasks:
81 - name: Retrieve all the mms-checksum entries
82 fortinet.fortimanager.fmgr_fact:
83 facts:
84 selector: "antivirus_mmschecksum_entries"
85 params:
86 adom: "FortiCarrier" # This is FOC-only object, data will only be returned under FortiCarrier adom
87 entries: ""
88 mms_checksum: "1" # id
89 '''
90
91 RETURN = '''
92 meta:
93 description: The result of the request.
94 type: dict
95 returned: always
96 contains:
97 request_url:
98 description: The full url requested.
99 returned: always
100 type: str
101 sample: /sys/login/user
102 response_code:
103 description: The status of api request.
104 returned: always
105 type: int
106 sample: 0
107 response_data:
108 description: The api response.
109 type: list
110 returned: always
111 response_message:
112 description: The descriptive message of the api response.
113 type: str
114 returned: always
115 sample: OK.
116 system_information:
117 description: The information of the target system.
118 type: dict
119 returned: always
120 rc:
121 description: The status the request.
122 type: int
123 returned: always
124 sample: 0
125 version_check_warning:
126 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
127 type: list
128 returned: complex
129 '''
130 from ansible.module_utils.basic import AnsibleModule
131 from ansible.module_utils.connection import Connection
132 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
133 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
134
135
136 def main():
137 urls_list = [
138 '/pm/config/adom/{adom}/obj/antivirus/mms-checksum/{mms-checksum}/entries',
139 '/pm/config/global/obj/antivirus/mms-checksum/{mms-checksum}/entries'
140 ]
141 module_arg_spec = {
142 'adom': {'required': True, 'type': 'str'},
143 'mms-checksum': {'type': 'str', 'api_name': 'mms_checksum'},
144 'mms_checksum': {'type': 'str'},
145 'revision_note': {'type': 'str'},
146 'antivirus_mmschecksum_entries': {
147 'type': 'dict', 'v_range': [['6.0.0', '7.6.2']],
148 'options': {
149 'checksum': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
150 'name': {'v_range': [['6.0.0', '7.6.2']], 'required': True, 'type': 'str'},
151 'status': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'}
152 }
153 }
154 }
155
156 module_option_spec = get_module_arg_spec('full crud')
157 module_arg_spec.update(module_option_spec)
158 check_galaxy_version(module_arg_spec)
159 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'antivirus_mmschecksum_entries'),
160 supports_check_mode=True)
161 if not module._socket_path:
162 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
163 connection = Connection(module._socket_path)
164 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
165 'name', 'data', module, connection)
166 fmgr.process_crud()
167 module.exit_json(meta=module.params)
168
169
170 if __name__ == '__main__':
171 main()