|
| 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 MaaSSubscription(NamespacedResource): |
| 11 | + """ |
| 12 | + MaaSSubscription is the Schema for the maassubscriptions API |
| 13 | + """ |
| 14 | + |
| 15 | + api_group: str = NamespacedResource.ApiGroup.MAAS_OPENDATAHUB_IO |
| 16 | + |
| 17 | + def __init__( |
| 18 | + self, |
| 19 | + billing_metadata: dict[str, Any] | None = None, |
| 20 | + model_refs: list[Any] | None = None, |
| 21 | + owner: dict[str, Any] | None = None, |
| 22 | + priority: int | None = None, |
| 23 | + **kwargs: Any, |
| 24 | + ) -> None: |
| 25 | + r""" |
| 26 | + Args: |
| 27 | + billing_metadata (dict[str, Any]): BillingMetadata contains billing information |
| 28 | +
|
| 29 | + model_refs (list[Any]): ModelRefs defines which models are included with per-model token rate |
| 30 | + limits |
| 31 | +
|
| 32 | + owner (dict[str, Any]): Owner defines who owns this subscription |
| 33 | +
|
| 34 | + priority (int): Priority determines subscription priority when user has multiple |
| 35 | + subscriptions Higher numbers have higher priority. Defaults to 0. |
| 36 | +
|
| 37 | + """ |
| 38 | + super().__init__(**kwargs) |
| 39 | + |
| 40 | + self.billing_metadata = billing_metadata |
| 41 | + self.model_refs = model_refs |
| 42 | + self.owner = owner |
| 43 | + self.priority = priority |
| 44 | + |
| 45 | + def to_dict(self) -> None: |
| 46 | + |
| 47 | + super().to_dict() |
| 48 | + |
| 49 | + if not self.kind_dict and not self.yaml_file: |
| 50 | + if self.model_refs is None: |
| 51 | + raise MissingRequiredArgumentError(argument="self.model_refs") |
| 52 | + |
| 53 | + if self.owner is None: |
| 54 | + raise MissingRequiredArgumentError(argument="self.owner") |
| 55 | + |
| 56 | + self.res["spec"] = {} |
| 57 | + _spec = self.res["spec"] |
| 58 | + |
| 59 | + _spec["modelRefs"] = self.model_refs |
| 60 | + _spec["owner"] = self.owner |
| 61 | + |
| 62 | + if self.billing_metadata is not None: |
| 63 | + _spec["billingMetadata"] = self.billing_metadata |
| 64 | + |
| 65 | + if self.priority is not None: |
| 66 | + _spec["priority"] = self.priority |
| 67 | + |
| 68 | + # End of generated code |
0 commit comments