Coverage for ocp_resources/config_map.py: 0%

21 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 NamespacedResource 

5 

6 

7class ConfigMap(NamespacedResource): 

8 """ 

9 ConfigMap holds configuration data for pods to consume. 

10 """ 

11 

12 api_version: str = NamespacedResource.ApiVersion.V1 

13 

14 def __init__( 

15 self, 

16 binary_data: Optional[Dict[str, Any]] = None, 

17 data: Optional[Dict[str, Any]] = None, 

18 immutable: Optional[bool] = None, 

19 **kwargs: Any, 

20 ) -> None: 

21 """ 

22 Args: 

23 binary_data (Dict[str, Any]): BinaryData contains the binary data. Each key must consist of 

24 alphanumeric characters, '-', '_' or '.'. BinaryData can contain 

25 byte sequences that are not in the UTF-8 range. The keys stored in 

26 BinaryData must not overlap with the ones in the Data field, this 

27 is enforced during validation process. Using this field will 

28 require 1.10+ apiserver and kubelet. 

29 

30 data (Dict[str, Any]): Data contains the configuration data. Each key must consist of 

31 alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 

32 byte sequences must use the BinaryData field. The keys stored in 

33 Data must not overlap with the keys in the BinaryData field, this 

34 is enforced during validation process. 

35 

36 immutable (bool): Immutable, if set to true, ensures that data stored in the ConfigMap 

37 cannot be updated (only object metadata can be modified). If not 

38 set to true, the field can be modified at any time. Defaulted to 

39 nil. 

40 

41 """ 

42 super().__init__(**kwargs) 

43 

44 self.binary_data = binary_data 

45 self.data = data 

46 self.immutable = immutable 

47 

48 def to_dict(self) -> None: 

49 super().to_dict() 

50 

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

52 if self.binary_data: 

53 self.res["binaryData"] = self.binary_data 

54 

55 if self.data: 

56 self.res["data"] = self.data 

57 

58 if self.immutable is not None: 

59 self.res["immutable"] = self.immutable 

60 

61 # End of generated code 

62 

63 @property 

64 def keys_to_hash(self): 

65 return ["data", "binaryData"]