Coverage for ocp_resources/virtual_machine_export.py: 0%

22 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 __future__ import annotations 

4from ocp_resources.resource import MissingRequiredArgumentError, NamespacedResource 

5 

6from typing import Any 

7 

8 

9class VirtualMachineExport(NamespacedResource): 

10 """ 

11 VirtualMachineExport defines the operation of exporting a VM source 

12 """ 

13 

14 api_group: str = NamespacedResource.ApiGroup.EXPORT_KUBEVIRT_IO 

15 

16 def __init__( 

17 self, 

18 source: dict[str, Any] | None = None, 

19 token_secret_ref: str | None = None, 

20 ttl_duration: str | None = None, 

21 **kwargs: Any, 

22 ) -> None: 

23 """ 

24 Args: 

25 source (dict[str, Any]): TypedLocalObjectReference contains enough information to let you 

26 locate the typed referenced object inside the same namespace. 

27 

28 token_secret_ref (str): TokenSecretRef is the name of the custom-defined secret that contains 

29 the token used by the export server pod 

30 

31 ttl_duration (str): ttlDuration limits the lifetime of an export If this field is set, 

32 after this duration has passed from counting from 

33 CreationTimestamp, the export is eligible to be automatically 

34 deleted. If this field is omitted, a reasonable default is 

35 applied. 

36 

37 """ 

38 super().__init__(**kwargs) 

39 

40 self.source = source 

41 self.token_secret_ref = token_secret_ref 

42 self.ttl_duration = ttl_duration 

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 self.source is None: 

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

50 

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

52 _spec = self.res["spec"] 

53 

54 _spec["source"] = self.source 

55 

56 if self.token_secret_ref: 

57 _spec["tokenSecretRef"] = self.token_secret_ref 

58 

59 if self.ttl_duration: 

60 _spec["ttlDuration"] = self.ttl_duration 

61 

62 # End of generated code