Skip to content

Commit b5578af

Browse files
authored
feat: Add migController resources (#2615)
Add migController resource following https://github.com/RedHatQE/openshift-python-wrapper/blob/main/class_generator/README.md
1 parent 8b8ff61 commit b5578af

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

ocp_resources/mig_controller.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md
2+
3+
4+
from typing import Any
5+
6+
from ocp_resources.resource import NamespacedResource
7+
8+
9+
class MigController(NamespacedResource):
10+
"""
11+
MigController is the Schema for the migcontrollers API.
12+
"""
13+
14+
api_group: str = NamespacedResource.ApiGroup.MIGRATIONS_KUBEVIRT_IO
15+
16+
def __init__(
17+
self,
18+
image_pull_policy: str | None = None,
19+
infra: dict[str, Any] | None = None,
20+
priority_class: str | None = None,
21+
**kwargs: Any,
22+
) -> None:
23+
r"""
24+
Args:
25+
image_pull_policy (str): PullPolicy describes a policy for if/when to pull a container image
26+
27+
infra (dict[str, Any]): Rules on which nodes infrastructure pods will be scheduled
28+
29+
priority_class (str): PriorityClass of the control plane
30+
31+
"""
32+
super().__init__(**kwargs)
33+
34+
self.image_pull_policy = image_pull_policy
35+
self.infra = infra
36+
self.priority_class = priority_class
37+
38+
def to_dict(self) -> None:
39+
40+
super().to_dict()
41+
42+
if not self.kind_dict and not self.yaml_file:
43+
self.res["spec"] = {}
44+
_spec = self.res["spec"]
45+
46+
if self.image_pull_policy is not None:
47+
_spec["imagePullPolicy"] = self.image_pull_policy
48+
49+
if self.infra is not None:
50+
_spec["infra"] = self.infra
51+
52+
if self.priority_class is not None:
53+
_spec["priorityClass"] = self.priority_class
54+
55+
# End of generated code

0 commit comments

Comments
 (0)