Debian Codegraph @

ansible_collections/hetzner/hcloud/plugins/module_utils/_experimental.py

raw
1 # Copyright: (c) 2025, Hetzner Cloud GmbH <[email protected]>
2
3 # Note that this module util is **PRIVATE** to the collection. It can have breaking changes at any time.
4 # Do not use this from other collections or standalone plugins/modules!
5
6 from __future__ import annotations
7
8 from ._base import AnsibleModule
9
10
11 def experimental_warning_function(product: str, maturity: str, url: str):
12 """
13 Create a reusable experimental warning function.
14
15 Usage:
16
17 product_experimental_warning = experimental_warning_function(
18 "Product",
19 "in beta",
20 "https://docs.hetzner.cloud/changelog#new-product",
21 )
22
23 class AnsibleProduct(AnsibleHCloud):
24 def __init__(self, module: AnsibleModule):
25 product_experimental_warning(module)
26 super().__init__(module)
27
28 :param product: Name of the product.
29 :param maturity: Maturity of the product.
30 :param url: Changelog URL announcing the product.
31 """
32 message = f"Experimental: {product} is {maturity}, breaking changes may occur within minor releases. See {url} for more details."
33
34 def fn(module: AnsibleModule):
35 module.warn(message)
36
37 return fn