Debian Codegraph @

ansible_collections/community/general/plugins/modules/utm_ca_host_key_cert_info.py

raw
1 #!/usr/bin/python
2
3 # Copyright (c) 2018, Stephan Schwarz <[email protected]>
4 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
5 # SPDX-License-Identifier: GPL-3.0-or-later
6
7 from __future__ import annotations
8
9 DOCUMENTATION = r"""
10 module: utm_ca_host_key_cert_info
11
12 author:
13 - Stephan Schwarz (@stearz)
14
15 short_description: Get info for a ca host_key_cert entry in Sophos UTM
16
17 description:
18 - Get info for a ca host_key_cert entry in SOPHOS UTM.
19 attributes:
20 check_mode:
21 version_added: 3.3.0
22 # This was backported to 2.5.4 and 1.3.11 as well, since this was a bugfix
23
24 options:
25 name:
26 type: str
27 description:
28 - The name of the object that identifies the entry.
29 required: true
30
31 extends_documentation_fragment:
32 - community.general._utm
33 - community.general._attributes
34 - community.general._attributes.info_module
35 """
36
37 EXAMPLES = r"""
38 - name: Get info for a ca host_key_cert entry
39 community.general.utm_ca_host_key_cert_info:
40 utm_host: sophos.host.name
41 utm_token: abcdefghijklmno1234
42 name: TestHostKeyCertEntry
43 """
44
45 RETURN = r"""
46 result:
47 description: The utm object that was created.
48 returned: success
49 type: complex
50 contains:
51 _ref:
52 description: The reference name of the object.
53 type: str
54 _locked:
55 description: Whether or not the object is currently locked.
56 type: bool
57 _type:
58 description: The type of the object.
59 type: str
60 name:
61 description: The name of the object.
62 type: str
63 ca:
64 description: A reference to an existing utm_ca_signing_ca or utm_ca_verification_ca object.
65 type: str
66 meta:
67 description: A reference to an existing utm_ca_meta_x509 object.
68 type: str
69 certificate:
70 description: The certificate in PEM format.
71 type: str
72 comment:
73 description: Comment string (may be empty string).
74 type: str
75 encrypted:
76 description: If encryption is enabled.
77 type: bool
78 key:
79 description: Private key in PEM format (may be empty string).
80 type: str
81 """
82
83 from ansible_collections.community.general.plugins.module_utils._utm_utils import UTM, UTMModule
84
85
86 def main():
87 endpoint = "ca/host_key_cert"
88 key_to_check_for_changes = []
89 module = UTMModule(
90 argument_spec=dict(name=dict(type="str", required=True)),
91 supports_check_mode=True,
92 )
93 try:
94 # This is needed because the bool value only accepts int values in the backend
95 UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
96 except Exception as e:
97 module.fail_json(msg=f"{e}")
98
99
100 if __name__ == "__main__":
101 main()