Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_certificate_remote.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_remote
15 short_description: Remote certificate.
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_remote:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 cert:
27 type: raw
28 description: (list) Remote certificate.
29 comment:
30 type: str
31 description: Remote certificate comment.
32 name:
33 type: str
34 description: Name.
35 required: true
36 '''
37
38 EXAMPLES = '''
39 - name: Example playbook (generated based on argument schema)
40 hosts: fortimanagers
41 connection: httpapi
42 gather_facts: false
43 tasks:
44 - name: Remote certificate.
45 fortinet.fortimanager.fmgr_system_certificate_remote:
46 # workspace_locking_adom: <global or your adom name>
47 state: present # <value in [present, absent]>
48 system_certificate_remote:
49 name: "your value" # Required variable, string
50 # cert: <list or string>
51 # comment: <string>
52 '''
53
54 RETURN = '''
55 meta:
56 description: The result of the request.
57 type: dict
58 returned: always
59 contains:
60 request_url:
61 description: The full url requested.
62 returned: always
63 type: str
64 sample: /sys/login/user
65 response_code:
66 description: The status of api request.
67 returned: always
68 type: int
69 sample: 0
70 response_data:
71 description: The api response.
72 type: list
73 returned: always
74 response_message:
75 description: The descriptive message of the api response.
76 type: str
77 returned: always
78 sample: OK.
79 system_information:
80 description: The information of the target system.
81 type: dict
82 returned: always
83 rc:
84 description: The status the request.
85 type: int
86 returned: always
87 sample: 0
88 version_check_warning:
89 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
90 type: list
91 returned: complex
92 '''
93 from ansible.module_utils.basic import AnsibleModule
94 from ansible.module_utils.connection import Connection
95 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
96 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
97
98
99 def main():
100 urls_list = [
101 '/cli/global/system/certificate/remote'
102 ]
103 module_arg_spec = {
104 'system_certificate_remote': {
105 'type': 'dict', 'v_range': [['6.0.0', '']],
106 'options': {'cert': {'type': 'raw'}, 'comment': {'type': 'str'}, 'name': {'required': True, 'type': 'str'}}
107 }
108 }
109
110 module_option_spec = get_module_arg_spec('full crud')
111 module_arg_spec.update(module_option_spec)
112 check_galaxy_version(module_arg_spec)
113 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_certificate_remote'),
114 supports_check_mode=True)
115 if not module._socket_path:
116 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
117 connection = Connection(module._socket_path)
118 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
119 'name', 'data', module, connection)
120 fmgr.process_crud()
121 module.exit_json(meta=module.params)
122
123
124 if __name__ == '__main__':
125 main()