- Notifications
You must be signed in to change notification settings - Fork 60
[ODSC_52446_52447] Get loggroups logids and compartment list #561
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
VipulMascarenhas merged 25 commits into feature/aqua from ODSC-52446_52447_get_loggroup_compartment_list Feb 3, 2024
+335 −97
Merged
Changes from all commits
Commits
Show all changes
25 commits Select commit Hold shift + click to select a range
d097c7e improved list model api
mingkang111 86b75c0 updated client
VipulMascarenhas 5b66a85 added logging and compartment apis
VipulMascarenhas 9e9169c updated config
VipulMascarenhas a784db3 resolve merge issues
VipulMascarenhas 574f7f0 use queryservice to get list results
mingkang111 567d661 address review comments
VipulMascarenhas 7b01fe3 fixed
mingkang111 c648a9a return empty string when value is null
mingkang111 cd4f2e8 fixed
mingkang111 73f8f7c reverted _if_show
mingkang111 91f78e5 move out ui helper apis
VipulMascarenhas f757765 move out ui helper apis
VipulMascarenhas 1669f42 added new ui handler
VipulMascarenhas 5f929d3 use ds_client.list for service model and use rqs for user model
mingkang111 61a1b53 review comments for shape info and readme
VipulMascarenhas abec3f6 reverted unrelated change
mingkang111 b9b1700 resolved conflicts
mingkang111 4ed895d resolve merge conflicts
VipulMascarenhas e35fbae minor changes
VipulMascarenhas 21c28f3 fix get model with empty tag
VipulMascarenhas 1586610 minor change
VipulMascarenhas 93f61a7 address review comments
VipulMascarenhas e3af5cc get instance count
VipulMascarenhas a2bfc83 merge from feature branch
VipulMascarenhas 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
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
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
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
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
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,75 @@ | ||
| #!/usr/bin/env python | ||
| # -*- coding: utf-8 -*- | ||
| # Copyright (c) 2024 Oracle and/or its affiliates. | ||
| # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ | ||
| | ||
| from tornado.web import HTTPError | ||
| from urllib.parse import urlparse | ||
| from ads.aqua.extension.base_handler import AquaAPIhandler | ||
| from ads.aqua.ui import AquaUIApp | ||
| | ||
| | ||
| class AquaUIHandler(AquaAPIhandler): | ||
| """ | ||
| Handler for Aqua UI REST APIs. | ||
| | ||
| Methods | ||
| ------- | ||
| get(self, id="") | ||
| Routes the request to fetch log groups, log ids details or compartments | ||
| list_log_groups(self, id: str) | ||
| Reads the AQUA deployment information. | ||
| list_logs(self, log_group_id: str, **kwargs) | ||
| Lists the specified log group's log objects. | ||
| list_compartments(self, **kwargs) | ||
| Lists the compartments in a compartment specified by ODSC_MODEL_COMPARTMENT_OCID env variable. | ||
| | ||
| Raises | ||
| ------ | ||
| HTTPError: For various failure scenarios such as invalid input format, missing data, etc. | ||
| """ | ||
| | ||
| def get(self, id=""): | ||
| """Handle GET request.""" | ||
| url_parse = urlparse(self.request.path) | ||
| paths = url_parse.path.strip("/") | ||
| if paths.startswith("aqua/logging"): | ||
| if not id: | ||
| return self.list_log_groups() | ||
| return self.list_logs(id) | ||
| elif paths.startswith("aqua/compartments"): | ||
| return self.list_compartments() | ||
| else: | ||
| raise HTTPError(400, f"The request {self.request.path} is invalid.") | ||
| | ||
| def list_log_groups(self, **kwargs): | ||
| """Lists all log groups for the specified compartment or tenancy.""" | ||
| compartment_id = self.get_argument("compartment_id") | ||
| try: | ||
| return self.finish( | ||
| AquaUIApp().list_log_groups(compartment_id=compartment_id, **kwargs) | ||
| ) | ||
| except Exception as ex: | ||
| raise HTTPError(500, str(ex)) | ||
| | ||
| def list_logs(self, log_group_id: str, **kwargs): | ||
| """Lists the specified log group's log objects.""" | ||
| try: | ||
| return self.finish( | ||
| AquaUIApp().list_logs(log_group_id=log_group_id, **kwargs) | ||
| ) | ||
| except Exception as ex: | ||
| raise HTTPError(500, str(ex)) | ||
| | ||
| def list_compartments(self, **kwargs): | ||
| """Lists the compartments in a compartment specified by ODSC_MODEL_COMPARTMENT_OCID env variable.""" | ||
| try: | ||
| return self.finish(AquaUIApp().list_compartments(**kwargs)) | ||
| except Exception as ex: | ||
| raise HTTPError(500, str(ex)) | ||
| | ||
| | ||
| __handlers__ = [ | ||
| ("logging/?([^/]*)", AquaUIHandler), | ||
| ("compartments/?([^/]*)", AquaUIHandler), | ||
| ] |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be cleaned up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keeping for now, we have an action item to clean all this up once exception handler PR is finalized.