diff --git a/class_generator/schema/__resources-mappings.json.gz b/class_generator/schema/__resources-mappings.json.gz index 521e494a62..7efbe7f26c 100644 Binary files a/class_generator/schema/__resources-mappings.json.gz and b/class_generator/schema/__resources-mappings.json.gz differ diff --git a/ocp_resources/maa_s_auth_policy.py b/ocp_resources/maa_s_auth_policy.py index e46a112a1e..5b9c49e8e6 100644 --- a/ocp_resources/maa_s_auth_policy.py +++ b/ocp_resources/maa_s_auth_policy.py @@ -2,6 +2,7 @@ from typing import Any +from warnings import warn from ocp_resources.exceptions import MissingRequiredArgumentError from ocp_resources.resource import NamespacedResource @@ -57,3 +58,11 @@ def to_dict(self) -> None: _spec["meteringMetadata"] = self.metering_metadata # End of generated code + + +warn( + "MaaSAuthPolicy from maa_s_auth_policy.py is deprecated and will be removed in a future release. " + "Please use `MaaSAuthPolicy` from maas_auth_policy.py instead.", + DeprecationWarning, + stacklevel=2, +) diff --git a/ocp_resources/maa_s_subscription.py b/ocp_resources/maa_s_subscription.py index 792ab658c5..ba648d8bc7 100644 --- a/ocp_resources/maa_s_subscription.py +++ b/ocp_resources/maa_s_subscription.py @@ -2,6 +2,7 @@ from typing import Any +from warnings import warn from ocp_resources.exceptions import MissingRequiredArgumentError from ocp_resources.resource import NamespacedResource @@ -66,3 +67,11 @@ def to_dict(self) -> None: _spec["priority"] = self.priority # End of generated code + + +warn( + "MaaSSubscription from maa_s_subscription.py is deprecated and will be removed in a future release. " + "Please use `MaaSSubscription` from maas_subscription.py instead.", + DeprecationWarning, + stacklevel=2, +) diff --git a/ocp_resources/maas_auth_policy.py b/ocp_resources/maas_auth_policy.py new file mode 100644 index 0000000000..6b2e505778 --- /dev/null +++ b/ocp_resources/maas_auth_policy.py @@ -0,0 +1,60 @@ +# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md + + +from typing import Any + +from ocp_resources.exceptions import MissingRequiredArgumentError +from ocp_resources.resource import NamespacedResource + + +class MaaSAuthPolicy(NamespacedResource): + """ + MaaSAuthPolicy is the Schema for the maasauthpolicies API + """ + + api_group: str = NamespacedResource.ApiGroup.MAAS_OPENDATAHUB_IO + + def __init__( + self, + metering_metadata: dict[str, Any] | None = None, + model_refs: list[Any] | None = None, + subjects: dict[str, Any] | None = None, + **kwargs: Any, + ) -> None: + r""" + Args: + metering_metadata (dict[str, Any]): MeteringMetadata contains billing and tracking information + + model_refs (list[Any]): ModelRefs is a list of models (by name and namespace) that this policy + grants access to + + subjects (dict[str, Any]): Subjects defines who has access (OR logic - any match grants access) + + """ + super().__init__(**kwargs) + + self.metering_metadata = metering_metadata + self.model_refs = model_refs + self.subjects = subjects + + def to_dict(self) -> None: + + super().to_dict() + + if not self.kind_dict and not self.yaml_file: + if self.model_refs is None: + raise MissingRequiredArgumentError(argument="self.model_refs") + + if self.subjects is None: + raise MissingRequiredArgumentError(argument="self.subjects") + + self.res["spec"] = {} + _spec = self.res["spec"] + + _spec["modelRefs"] = self.model_refs + _spec["subjects"] = self.subjects + + if self.metering_metadata is not None: + _spec["meteringMetadata"] = self.metering_metadata + + # End of generated code diff --git a/ocp_resources/maas_subscription.py b/ocp_resources/maas_subscription.py new file mode 100644 index 0000000000..d7ebf8a4da --- /dev/null +++ b/ocp_resources/maas_subscription.py @@ -0,0 +1,68 @@ +# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md + + +from typing import Any + +from ocp_resources.exceptions import MissingRequiredArgumentError +from ocp_resources.resource import NamespacedResource + + +class MaaSSubscription(NamespacedResource): + """ + MaaSSubscription is the Schema for the maassubscriptions API + """ + + api_group: str = NamespacedResource.ApiGroup.MAAS_OPENDATAHUB_IO + + def __init__( + self, + model_refs: list[Any] | None = None, + owner: dict[str, Any] | None = None, + priority: int | None = None, + token_metadata: dict[str, Any] | None = None, + **kwargs: Any, + ) -> None: + r""" + Args: + model_refs (list[Any]): ModelRefs defines which models are included with per-model token rate + limits + + owner (dict[str, Any]): Owner defines who owns this subscription + + priority (int): Priority determines subscription priority when user has multiple + subscriptions Higher numbers have higher priority. Defaults to 0. + + token_metadata (dict[str, Any]): TokenMetadata contains metadata for token attribution and metering + + """ + super().__init__(**kwargs) + + self.model_refs = model_refs + self.owner = owner + self.priority = priority + self.token_metadata = token_metadata + + def to_dict(self) -> None: + + super().to_dict() + + if not self.kind_dict and not self.yaml_file: + if self.model_refs is None: + raise MissingRequiredArgumentError(argument="self.model_refs") + + if self.owner is None: + raise MissingRequiredArgumentError(argument="self.owner") + + self.res["spec"] = {} + _spec = self.res["spec"] + + _spec["modelRefs"] = self.model_refs + _spec["owner"] = self.owner + + if self.priority is not None: + _spec["priority"] = self.priority + + if self.token_metadata is not None: + _spec["tokenMetadata"] = self.token_metadata + + # End of generated code