-
Notifications
You must be signed in to change notification settings - Fork 73
feat: Add MaaSAuthPolicy,MaaSSubscription,MaaSModel resources #2660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # 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 model names 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # 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 MaaSModel(NamespacedResource): | ||
| """ | ||
| MaaSModel is the Schema for the maasmodels API | ||
| """ | ||
|
|
||
| api_group: str = NamespacedResource.ApiGroup.MAAS_OPENDATAHUB_IO | ||
|
|
||
| def __init__( | ||
| self, | ||
| model_ref: dict[str, Any] | None = None, | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| r""" | ||
| Args: | ||
| model_ref (dict[str, Any]): ModelRef references the actual model endpoint | ||
|
|
||
| """ | ||
| super().__init__(**kwargs) | ||
|
|
||
| self.model_ref = model_ref | ||
|
|
||
| def to_dict(self) -> None: | ||
|
|
||
| super().to_dict() | ||
|
|
||
| if not self.kind_dict and not self.yaml_file: | ||
| if self.model_ref is None: | ||
| raise MissingRequiredArgumentError(argument="self.model_ref") | ||
|
|
||
| self.res["spec"] = {} | ||
| _spec = self.res["spec"] | ||
|
|
||
| _spec["modelRef"] = self.model_ref | ||
|
|
||
| # End of generated code | ||
SB159 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| billing_metadata: dict[str, Any] | None = None, | ||
| model_refs: list[Any] | None = None, | ||
| owner: dict[str, Any] | None = None, | ||
| priority: int | None = None, | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| r""" | ||
| Args: | ||
| billing_metadata (dict[str, Any]): BillingMetadata contains billing information | ||
|
|
||
| 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. | ||
|
|
||
| """ | ||
| super().__init__(**kwargs) | ||
|
|
||
| self.billing_metadata = billing_metadata | ||
| self.model_refs = model_refs | ||
| self.owner = owner | ||
| self.priority = priority | ||
|
|
||
| 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.billing_metadata is not None: | ||
| _spec["billingMetadata"] = self.billing_metadata | ||
|
|
||
| if self.priority is not None: | ||
| _spec["priority"] = self.priority | ||
|
|
||
| # End of generated code | ||
SB159 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.