Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fmupdate_fdssetting_updateschedule.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_fmupdate_fdssetting_updateschedule
15 short_description: Configure the schedule when built-in FortiGuard retrieves antivirus and IPS updates.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 fmupdate_fdssetting_updateschedule:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 day:
27 type: str
28 description:
29 - Configure the day the update will occur, if the freqnecy is weekly
30 - Sunday - Update every Sunday.
31 - Monday - Update every Monday.
32 - Tuesday - Update every Tuesday.
33 - Wednesday - Update every Wednesday.
34 - Thursday - Update every Thursday.
35 - Friday - Update every Friday.
36 - Saturday - Update every Saturday.
37 choices: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',
38 'Saturday']
39 frequency:
40 type: str
41 description:
42 - Configure update frequency
43 - every - Time interval.
44 - daily - Every day.
45 - weekly - Every week.
46 choices: ['every', 'daily', 'weekly']
47 status:
48 type: str
49 description:
50 - Enable/disable scheduled updates.
51 - disable - Disable setting.
52 - enable - Enable setting.
53 choices: ['disable', 'enable']
54 time:
55 type: raw
56 description: (list) Time interval between updates, or the hour and minute when the update occurs
57 '''
58
59 EXAMPLES = '''
60 - name: Example playbook (generated based on argument schema)
61 hosts: fortimanagers
62 connection: httpapi
63 gather_facts: false
64 tasks:
65 - name: Configure the schedule when built-in FortiGuard retrieves antivirus and IPS updates.
66 fortinet.fortimanager.fmgr_fmupdate_fdssetting_updateschedule:
67 # workspace_locking_adom: <global or your adom name>
68 fmupdate_fdssetting_updateschedule:
69 # day: <value in [Sunday, Monday, Tuesday, ...]>
70 # frequency: <value in [every, daily, weekly]>
71 # status: <value in [disable, enable]>
72 # time: <list or string>
73 '''
74
75 RETURN = '''
76 meta:
77 description: The result of the request.
78 type: dict
79 returned: always
80 contains:
81 request_url:
82 description: The full url requested.
83 returned: always
84 type: str
85 sample: /sys/login/user
86 response_code:
87 description: The status of api request.
88 returned: always
89 type: int
90 sample: 0
91 response_data:
92 description: The api response.
93 type: list
94 returned: always
95 response_message:
96 description: The descriptive message of the api response.
97 type: str
98 returned: always
99 sample: OK.
100 system_information:
101 description: The information of the target system.
102 type: dict
103 returned: always
104 rc:
105 description: The status the request.
106 type: int
107 returned: always
108 sample: 0
109 version_check_warning:
110 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
111 type: list
112 returned: complex
113 '''
114 from ansible.module_utils.basic import AnsibleModule
115 from ansible.module_utils.connection import Connection
116 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
117 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
118
119
120 def main():
121 urls_list = [
122 '/cli/global/fmupdate/fds-setting/update-schedule'
123 ]
124 module_arg_spec = {
125 'fmupdate_fdssetting_updateschedule': {
126 'type': 'dict', 'v_range': [['6.0.0', '']],
127 'options': {
128 'day': {'choices': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], 'type': 'str'},
129 'frequency': {'choices': ['every', 'daily', 'weekly'], 'type': 'str'},
130 'status': {'choices': ['disable', 'enable'], 'type': 'str'},
131 'time': {'type': 'raw'}
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, 'fmupdate_fdssetting_updateschedule'),
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()