Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified class_generator/schema/__resources-mappings.json.gz
Binary file not shown.
9 changes: 9 additions & 0 deletions ocp_resources/maa_s_auth_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


from typing import Any
from warnings import warn

from ocp_resources.exceptions import MissingRequiredArgumentError
from ocp_resources.resource import NamespacedResource
Expand Down Expand Up @@ -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,
)
9 changes: 9 additions & 0 deletions ocp_resources/maa_s_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


from typing import Any
from warnings import warn

from ocp_resources.exceptions import MissingRequiredArgumentError
from ocp_resources.resource import NamespacedResource
Expand Down Expand Up @@ -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,
)
60 changes: 60 additions & 0 deletions ocp_resources/maas_auth_policy.py
Original file line number Diff line number Diff line change
@@ -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
68 changes: 68 additions & 0 deletions ocp_resources/maas_subscription.py
Original file line number Diff line number Diff line change
@@ -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