Coverage for ocp_resources/volume_snapshot_class.py: 0%

20 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-01-30 10:48 +0200

1# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md 

2 

3from typing import Any, Dict, Optional 

4from ocp_resources.resource import Resource, MissingRequiredArgumentError 

5 

6 

7class VolumeSnapshotClass(Resource): 

8 """ 

9 VolumeSnapshotClass specifies parameters that a underlying storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses are non-namespaced 

10 """ 

11 

12 api_group: str = Resource.ApiGroup.SNAPSHOT_STORAGE_K8S_IO 

13 

14 def __init__( 

15 self, 

16 deletion_policy: Optional[str] = "", 

17 driver: Optional[str] = "", 

18 parameters: Optional[Dict[str, Any]] = None, 

19 **kwargs: Any, 

20 ) -> None: 

21 """ 

22 Args: 

23 deletion_policy (str): deletionPolicy determines whether a VolumeSnapshotContent created 

24 through the VolumeSnapshotClass should be deleted when its bound 

25 VolumeSnapshot is deleted. Supported values are "Retain" and 

26 "Delete". "Retain" means that the VolumeSnapshotContent and its 

27 physical snapshot on underlying storage system are kept. "Delete" 

28 means that the VolumeSnapshotContent and its physical snapshot on 

29 underlying storage system are deleted. Required. 

30 

31 driver (str): driver is the name of the storage driver that handles this 

32 VolumeSnapshotClass. Required. 

33 

34 parameters (Dict[str, Any]): parameters is a key-value map with storage driver specific parameters 

35 for creating snapshots. These values are opaque to Kubernetes. 

36 

37 """ 

38 super().__init__(**kwargs) 

39 

40 self.deletion_policy = deletion_policy 

41 self.driver = driver 

42 self.parameters = parameters 

43 

44 def to_dict(self) -> None: 

45 super().to_dict() 

46 

47 if not self.kind_dict and not self.yaml_file: 

48 if not self.deletion_policy: 

49 raise MissingRequiredArgumentError(argument="self.deletion_policy") 

50 

51 if not self.driver: 

52 raise MissingRequiredArgumentError(argument="self.driver") 

53 

54 self.res["deletionPolicy"] = self.deletion_policy 

55 self.res["driver"] = self.driver 

56 

57 if self.parameters: 

58 self.res["parameters"] = self.parameters 

59 

60 # End of generated code