Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_certificate_crl.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_certificate_crl
15 short_description: Certificate Revocation List.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 system_certificate_crl:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 comment:
27 type: str
28 description: Comment of this Certificate Revocation List.
29 crl:
30 type: raw
31 description: (list) Certificate Revocation List.
32 name:
33 type: str
34 description: Name.
35 required: true
36 http_url:
37 aliases: ['http-url']
38 type: str
39 description: HTTP server URL for CRL auto-update
40 update_interval:
41 aliases: ['update-interval']
42 type: int
43 description: CRL auto-update interval
44 '''
45
46 EXAMPLES = '''
47 - name: Example playbook
48 hosts: fortimanagers
49 gather_facts: false
50 connection: httpapi
51 vars:
52 ansible_httpapi_use_ssl: true
53 ansible_httpapi_validate_certs: false
54 ansible_httpapi_port: 443
55 tasks:
56 - name: Certificate Revocation List.
57 fortinet.fortimanager.fmgr_system_certificate_crl:
58 bypass_validation: false
59 state: present
60 system_certificate_crl:
61 comment: ansible-comment
62 crl: ansible-crl
63 name: ansible-test-crl
64
65 - name: Gathering fortimanager facts
66 hosts: fortimanagers
67 gather_facts: false
68 connection: httpapi
69 vars:
70 ansible_httpapi_use_ssl: true
71 ansible_httpapi_validate_certs: false
72 ansible_httpapi_port: 443
73 tasks:
74 - name: Retrieve all the certificate Revocation Lists
75 fortinet.fortimanager.fmgr_fact:
76 facts:
77 selector: "system_certificate_crl"
78 params:
79 crl: "your_value"
80 '''
81
82 RETURN = '''
83 meta:
84 description: The result of the request.
85 type: dict
86 returned: always
87 contains:
88 request_url:
89 description: The full url requested.
90 returned: always
91 type: str
92 sample: /sys/login/user
93 response_code:
94 description: The status of api request.
95 returned: always
96 type: int
97 sample: 0
98 response_data:
99 description: The api response.
100 type: list
101 returned: always
102 response_message:
103 description: The descriptive message of the api response.
104 type: str
105 returned: always
106 sample: OK.
107 system_information:
108 description: The information of the target system.
109 type: dict
110 returned: always
111 rc:
112 description: The status the request.
113 type: int
114 returned: always
115 sample: 0
116 version_check_warning:
117 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
118 type: list
119 returned: complex
120 '''
121 from ansible.module_utils.basic import AnsibleModule
122 from ansible.module_utils.connection import Connection
123 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
124 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
125
126
127 def main():
128 urls_list = [
129 '/cli/global/system/certificate/crl'
130 ]
131 module_arg_spec = {
132 'system_certificate_crl': {
133 'type': 'dict', 'v_range': [['6.0.0', '']],
134 'options': {
135 'comment': {'type': 'str'},
136 'crl': {'type': 'raw'},
137 'name': {'required': True, 'type': 'str'},
138 'http-url': {'v_range': [['6.2.2', '']], 'type': 'str'},
139 'update-interval': {'v_range': [['6.2.2', '']], 'type': 'int'}
140 }
141 }
142 }
143
144 module_option_spec = get_module_arg_spec('full crud')
145 module_arg_spec.update(module_option_spec)
146 check_galaxy_version(module_arg_spec)
147 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_certificate_crl'),
148 supports_check_mode=True)
149 if not module._socket_path:
150 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
151 connection = Connection(module._socket_path)
152 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
153 'name', 'data', module, connection)
154 fmgr.process_crud()
155 module.exit_json(meta=module.params)
156
157
158 if __name__ == '__main__':
159 main()