-
Notifications
You must be signed in to change notification settings - Fork 60
[Ready to merge] Onboarding BYOR feature in AQUA #1179
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
Changes from 2 commits
4e5d238
6bdf50e
9720f2d
bf2ae08
31c4d38
4dfc037
df69212
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ | |
| from ads.aqua.extension.utils import validate_function_parameters | ||
| from ads.aqua.model.entities import ImportModelDetails | ||
| from ads.aqua.ui import AquaUIApp | ||
| from ads.config import COMPARTMENT_OCID | ||
| from ads.config import COMPARTMENT_OCID, IS_BYOR_ENABLED | ||
|
|
||
|
|
||
| @dataclass | ||
|
|
@@ -82,6 +82,10 @@ def get(self, id=""): | |
| return self.is_bucket_versioned() | ||
| elif paths.startswith("aqua/containers"): | ||
| return self.list_containers() | ||
| elif paths.startswith("aqua/capacityreservations/enabled"): | ||
| return self.is_capacity_reservations_enabled() | ||
| elif paths.startswith("aqua/capacityreservations"): | ||
| return self.list_capacity_reservations() | ||
| else: | ||
| raise HTTPError(400, f"The request {self.request.path} is invalid.") | ||
|
|
||
|
|
@@ -103,6 +107,17 @@ def list_log_groups(self, **kwargs): | |
| AquaUIApp().list_log_groups(compartment_id=compartment_id, **kwargs) | ||
| ) | ||
|
|
||
| def is_capacity_reservations_enabled(self, **kwargs): | ||
| return self.finish({"status": str(IS_BYOR_ENABLED).strip().lower() == "true"}) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we do None check here or set False as default in config.py?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. Thanks |
||
|
|
||
| def list_capacity_reservations(self, **kwargs): | ||
| compartment_id = self.get_argument("compartment_id", default=COMPARTMENT_OCID) | ||
| return self.finish( | ||
| AquaUIApp().list_capacity_reservations( | ||
| compartment_id=compartment_id, **kwargs | ||
| ) | ||
| ) | ||
|
|
||
| def list_logs(self, log_group_id: str, **kwargs): | ||
| """Lists the specified log group's log objects.""" | ||
| return self.finish(AquaUIApp().list_logs(log_group_id=log_group_id, **kwargs)) | ||
|
|
@@ -279,4 +294,5 @@ def post(self, *args, **kwargs): | |
| ("bucket/versioning/?([^/]*)", AquaUIHandler), | ||
| ("containers/?([^/]*)", AquaUIHandler), | ||
| ("cli/?([^/]*)", AquaCLIHandler), | ||
| ("capacityreservations/?([^/]*)", AquaUIHandler), | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,6 +90,16 @@ def list_logs(self, **kwargs) -> str: | |
| res = self.logging_client.list_logs(log_group_id=log_group_id, **kwargs).data | ||
| return sanitize_response(oci_client=self.logging_client, response=res) | ||
|
|
||
| @telemetry(entry_point="plugin=ui&action=list_capacity_reservations", name="aqua") | ||
| def list_capacity_reservations(self, **kwargs): | ||
|
||
| compartment_id = kwargs.pop("compartment_id", COMPARTMENT_OCID) | ||
| logger.info(f"Loading Capacity reservations from compartment: {compartment_id}") | ||
| compute_client = oc.OCIClientFactory(**default_signer()).compute | ||
|
||
| reservations = compute_client.list_compute_capacity_reservations( | ||
| compartment_id=compartment_id | ||
| ) | ||
| return reservations.data | ||
|
|
||
| @telemetry(entry_point="plugin=ui&action=list_compartments", name="aqua") | ||
| def list_compartments(self) -> str: | ||
| """Lists the compartments in a tenancy specified by TENANCY_OCID env variable. This is a pass through the OCI list_compartments | ||
|
|
||
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.
let's add pydocs, and also add what we extract from kwargs?
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.
Updated. Thanks