Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_replacemsgimage.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_replacemsgimage
15 short_description: Configure replacement message images.
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 system_replacemsgimage:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 image_base64:
34 aliases: ['image-base64']
35 type: str
36 description: Image data.
37 image_type:
38 aliases: ['image-type']
39 type: str
40 description: Image type.
41 choices: ['gif', 'jpg', 'tiff', 'png']
42 name:
43 type: str
44 description: Image name.
45 required: true
46 '''
47
48 EXAMPLES = '''
49 - name: Example playbook
50 hosts: fortimanagers
51 gather_facts: false
52 connection: httpapi
53 vars:
54 ansible_httpapi_use_ssl: true
55 ansible_httpapi_validate_certs: false
56 ansible_httpapi_port: 443
57 tasks:
58 - name: Configure replacement message images.
59 fortinet.fortimanager.fmgr_system_replacemsgimage:
60 bypass_validation: false
61 adom: ansible
62 state: present
63 system_replacemsgimage:
64 image_type: jpg # <value in [gif, jpg, tiff, ...]>
65 name: ansible-image
66
67 - name: Gathering fortimanager facts
68 hosts: fortimanagers
69 gather_facts: false
70 connection: httpapi
71 vars:
72 ansible_httpapi_use_ssl: true
73 ansible_httpapi_validate_certs: false
74 ansible_httpapi_port: 443
75 tasks:
76 - name: Retrieve all the replacement message images
77 fortinet.fortimanager.fmgr_fact:
78 facts:
79 selector: "system_replacemsgimage"
80 params:
81 adom: "ansible"
82 replacemsg_image: "your_value"
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-image',
133 '/pm/config/global/obj/system/replacemsg-image'
134 ]
135 module_arg_spec = {
136 'adom': {'required': True, 'type': 'str'},
137 'revision_note': {'type': 'str'},
138 'system_replacemsgimage': {
139 'type': 'dict', 'v_range': [['6.0.0', '']],
140 'options': {
141 'image-base64': {'type': 'str'},
142 'image-type': {'choices': ['gif', 'jpg', 'tiff', 'png'], 'type': 'str'},
143 'name': {'required': True, 'type': 'str'}
144 }
145 }
146 }
147
148 module_option_spec = get_module_arg_spec('full crud')
149 module_arg_spec.update(module_option_spec)
150 check_galaxy_version(module_arg_spec)
151 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_replacemsgimage'),
152 supports_check_mode=True)
153 if not module._socket_path:
154 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
155 connection = Connection(module._socket_path)
156 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
157 'name', 'data', module, connection)
158 fmgr.process_crud()
159 module.exit_json(meta=module.params)
160
161
162 if __name__ == '__main__':
163 main()