|
| 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.exceptions import MissingRequiredArgumentError |
| 7 | +from ocp_resources.resource import NamespacedResource |
| 8 | + |
| 9 | + |
| 10 | +class VirtualMachineTemplate(NamespacedResource): |
| 11 | + """ |
| 12 | + VirtualMachineTemplate is the Schema for the virtualmachinetemplates API |
| 13 | + """ |
| 14 | + |
| 15 | + api_group: str = NamespacedResource.ApiGroup.TEMPLATE_KUBEVIRT_IO |
| 16 | + |
| 17 | + def __init__( |
| 18 | + self, |
| 19 | + message: str | None = None, |
| 20 | + parameters: list[Any] | None = None, |
| 21 | + virtual_machine: dict[str, Any] | None = None, |
| 22 | + **kwargs: Any, |
| 23 | + ) -> None: |
| 24 | + r""" |
| 25 | + Args: |
| 26 | + message (str): Message is an optional instructional message for this template. This |
| 27 | + field should inform the user how to utilize the newly created |
| 28 | + VirtualMachine. |
| 29 | +
|
| 30 | + parameters (list[Any]): Parameters is an optional list of Parameters used during processing of |
| 31 | + the template. |
| 32 | +
|
| 33 | + virtual_machine (dict[str, Any]): VirtualMachine is the template VirtualMachine to include in this |
| 34 | + template. If a namespace value is hardcoded, it will be removed |
| 35 | + during processing of the template. If the namespace value however |
| 36 | + contains a ${PARAMETER_REFERENCE}, the resolved value after |
| 37 | + parameter substitution will be respected and the VirtualMachine |
| 38 | + will be created in that namespace. |
| 39 | +
|
| 40 | + """ |
| 41 | + super().__init__(**kwargs) |
| 42 | + |
| 43 | + self.message = message |
| 44 | + self.parameters = parameters |
| 45 | + self.virtual_machine = virtual_machine |
| 46 | + |
| 47 | + def to_dict(self) -> None: |
| 48 | + |
| 49 | + super().to_dict() |
| 50 | + |
| 51 | + if not self.kind_dict and not self.yaml_file: |
| 52 | + if self.virtual_machine is None: |
| 53 | + raise MissingRequiredArgumentError(argument="self.virtual_machine") |
| 54 | + |
| 55 | + self.res["spec"] = {} |
| 56 | + _spec = self.res["spec"] |
| 57 | + |
| 58 | + _spec["virtualMachine"] = self.virtual_machine |
| 59 | + |
| 60 | + if self.message is not None: |
| 61 | + _spec["message"] = self.message |
| 62 | + |
| 63 | + if self.parameters is not None: |
| 64 | + _spec["parameters"] = self.parameters |
| 65 | + |
| 66 | + # End of generated code |
0 commit comments