Coverage for src/gitlabracadabra/containers/registry.py: 100%

1#

2# Copyright (C) 2019-2022 Mathieu Parent <math.parent@gmail.com>

3#

4# This program is free software: you can redistribute it and/or modify

5# it under the terms of the GNU Lesser General Public License as published by

6# the Free Software Foundation, either version 3 of the License, or

7# (at your option) any later version.

8#

9# This program is distributed in the hope that it will be useful,

10# but WITHOUT ANY WARRANTY; without even the implied warranty of

11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

12# GNU Lesser General Public License for more details.

13#

14# You should have received a copy of the GNU Lesser General Public License

15# along with this program. If not, see <http://www.gnu.org/licenses/>.

16

17 from __future__ import annotations

18

19 from gitlabracadabra.containers.blob import Blob

20 from gitlabracadabra.containers.manifest import Manifest

21 from gitlabracadabra.containers.registry_importer import RegistryImporter

22

23

24 class Registry(RegistryImporter):

25 """Container registry."""

26

27 def manifest(self, manifest_name: str, tag: str = "latest") -> Manifest:

28 """Connect.

29

30 Args:

31 manifest_name: Manifest name. Example: 'library/debian'.

32 tag: A tag. Example: 'latest'.

33

34 Returns:

35 A Manifest object.

36 """

37 return Manifest(self, manifest_name, tag=tag)

38

39 def blob(self, manifest_name: str, digest: str) -> Blob:

40 """Connect.

41

42 Args:

43 manifest_name: Manifest name. Example: 'library/debian'.

44 digest: A digest. Example: 'latest'.

45

46 Returns:

47 A Manifest object.

48 """

49 return Blob(self, manifest_name, digest)