Coverage for ocp_resources/image_digest_mirror_set.py: 0%
12 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
1from ocp_resources.resource import MissingRequiredArgumentError, Resource
4class ImageDigestMirrorSet(Resource):
5 """
6 API reference:
7 https://docs.openshift.com/container-platform/4.14/rest_api/config_apis/imagedigestmirrorset-config-openshift-io-v1.html
8 """
10 api_group = Resource.ApiGroup.CONFIG_OPENSHIFT_IO
12 def __init__(self, image_digest_mirrors=None, **kwargs):
13 """
14 Create/Manage ImageDigestMirrorSet configuration object.
16 Args:
17 image_digest_mirrors (list of dict):
18 e.g. [{source: <str>, mirrors: <list>}, ..., {source: <str>, mirrors: <list>}]
19 - source - the repository that users refer to, e.g. in image pull specifications
20 - mirrors - one or more repositories (str) that may also contain the same images. The order
21 of mirrors in this list is treated as the user’s desired priority
22 """
23 self.image_digest_mirrors = image_digest_mirrors
24 super().__init__(**kwargs)
26 def to_dict(self) -> None:
27 super().to_dict()
28 if not self.kind_dict and not self.yaml_file:
29 if not self.image_digest_mirrors:
30 raise MissingRequiredArgumentError(argument="image_digest_mirrors")
31 self.res["spec"] = {"imageDigestMirrors": self.image_digest_mirrors}