Coverage for ocp_resources/model_registry.py: 0%

34 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, MissingRequiredArgumentError 

5 

6 

7class ModelRegistry(NamespacedResource): 

8 """ 

9 ModelRegistry is the Schema for the modelregistries API 

10 """ 

11 

12 api_group: str = NamespacedResource.ApiGroup.MODELREGISTRY_OPENDATAHUB_IO 

13 

14 def __init__( 

15 self, 

16 downgrade_db_schema_version: Optional[int] = None, 

17 enable_database_upgrade: Optional[bool] = None, 

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

19 istio: Optional[Dict[str, Any]] = None, 

20 mysql: Optional[Dict[str, Any]] = None, 

21 postgres: Optional[Dict[str, Any]] = None, 

22 rest: Optional[Dict[str, Any]] = None, 

23 **kwargs: Any, 

24 ) -> None: 

25 """ 

26 Args: 

27 downgrade_db_schema_version (int): Database downgrade schema version value. If set the database schema 

28 version is downgraded to the set value during initialization 

29 (Optional Parameter) 

30 

31 enable_database_upgrade (bool): Flag specifying database upgrade option. If set to true, it enables 

32 database migration during initialization (Optional parameter) 

33 

34 grpc (Dict[str, Any]): Configuration for gRPC endpoint 

35 

36 istio (Dict[str, Any]): Istio servicemesh configuration options 

37 

38 mysql (Dict[str, Any]): MySQL configuration options 

39 

40 postgres (Dict[str, Any]): PostgreSQL configuration options 

41 

42 rest (Dict[str, Any]): Configuration for REST endpoint 

43 

44 """ 

45 super().__init__(**kwargs) 

46 

47 self.downgrade_db_schema_version = downgrade_db_schema_version 

48 self.enable_database_upgrade = enable_database_upgrade 

49 self.grpc = grpc 

50 self.istio = istio 

51 self.mysql = mysql 

52 self.postgres = postgres 

53 self.rest = rest 

54 

55 def to_dict(self) -> None: 

56 super().to_dict() 

57 

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

59 if self.grpc is None: 

60 raise MissingRequiredArgumentError(argument="self.grpc") 

61 

62 if self.rest is None: 

63 raise MissingRequiredArgumentError(argument="self.rest") 

64 

65 self.res["spec"] = {} 

66 _spec = self.res["spec"] 

67 

68 _spec["grpc"] = self.grpc 

69 _spec["rest"] = self.rest 

70 

71 if self.downgrade_db_schema_version: 

72 _spec["downgrade_db_schema_version"] = self.downgrade_db_schema_version 

73 

74 if self.enable_database_upgrade is not None: 

75 _spec["enable_database_upgrade"] = self.enable_database_upgrade 

76 

77 if self.istio: 

78 _spec["istio"] = self.istio 

79 

80 if self.mysql: 

81 _spec["mysql"] = self.mysql 

82 

83 if self.postgres: 

84 _spec["postgres"] = self.postgres 

85 

86 # End of generated code