Coverage for ocp_resources/virtual_machine_instance_replica_set.py: 0%

25 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 VirtualMachineInstanceReplicaSet(NamespacedResource): 

8 """ 

9 VirtualMachineInstance is *the* VirtualMachineInstance Definition. It represents a virtual machine in the runtime environment of kubernetes. 

10 """ 

11 

12 api_group: str = NamespacedResource.ApiGroup.KUBEVIRT_IO 

13 

14 def __init__( 

15 self, 

16 paused: Optional[bool] = None, 

17 replicas: Optional[int] = None, 

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

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

20 **kwargs: Any, 

21 ) -> None: 

22 """ 

23 Args: 

24 paused (bool): Indicates that the replica set is paused. 

25 

26 replicas (int): Number of desired pods. This is a pointer to distinguish between 

27 explicit zero and not specified. Defaults to 1. 

28 

29 selector (Dict[str, Any]): Label selector for pods. Existing ReplicaSets whose pods are selected 

30 by this will be the ones affected by this deployment. 

31 

32 template (Dict[str, Any]): Template describes the pods that will be created. 

33 

34 """ 

35 super().__init__(**kwargs) 

36 

37 self.paused = paused 

38 self.replicas = replicas 

39 self.selector = selector 

40 self.template = template 

41 

42 def to_dict(self) -> None: 

43 super().to_dict() 

44 

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

46 if not self.selector: 

47 raise MissingRequiredArgumentError(argument="self.selector") 

48 

49 if not self.template: 

50 raise MissingRequiredArgumentError(argument="self.template") 

51 

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

53 _spec = self.res["spec"] 

54 

55 _spec["selector"] = self.selector 

56 _spec["template"] = self.template 

57 

58 if self.paused is not None: 

59 _spec["paused"] = self.paused 

60 

61 if self.replicas: 

62 _spec["replicas"] = self.replicas 

63 

64 # End of generated code