|
1 | 1 | #!/usr/bin/env python |
2 | | -# -*- coding: utf-8 -*- |
3 | 2 | # Copyright (c) 2024 Oracle and/or its affiliates. |
4 | 3 | # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ |
5 | 4 |
|
|
10 | 9 |
|
11 | 10 | from ads.aqua.common.decorator import handle_exceptions |
12 | 11 | from ads.aqua.common.enums import Tags |
13 | | -from ads.aqua.extension.errors import Errors |
| 12 | +from ads.aqua.constants import PRIVATE_ENDPOINT_TYPE |
14 | 13 | from ads.aqua.extension.base_handler import AquaAPIhandler |
| 14 | +from ads.aqua.extension.errors import Errors |
15 | 15 | from ads.aqua.extension.utils import validate_function_parameters |
16 | 16 | from ads.aqua.model.entities import ImportModelDetails |
17 | 17 | from ads.aqua.ui import AquaUIApp |
@@ -72,6 +72,8 @@ def get(self, id=""): |
72 | 72 | return self.list_vcn() |
73 | 73 | elif paths.startswith("aqua/subnets"): |
74 | 74 | return self.list_subnets() |
| 75 | + elif paths.startswith("aqua/privateendpoints"): |
| 76 | + return self.list_private_endpoints() |
75 | 77 | elif paths.startswith("aqua/shapes/limit"): |
76 | 78 | return self.get_shape_availability() |
77 | 79 | elif paths.startswith("aqua/bucket/versioning"): |
@@ -175,15 +177,31 @@ def list_subnets(self, **kwargs): |
175 | 177 | ) |
176 | 178 | ) |
177 | 179 |
|
| 180 | + def list_private_endpoints(self, **kwargs): |
| 181 | + """Lists the private endpoints in the specified compartment.""" |
| 182 | + compartment_id = self.get_argument("compartment_id", default=COMPARTMENT_OCID) |
| 183 | + resource_type = self.get_argument( |
| 184 | + "resource_type", default=PRIVATE_ENDPOINT_TYPE |
| 185 | + ) |
| 186 | + return self.finish( |
| 187 | + AquaUIApp().list_private_endpoints( |
| 188 | + compartment_id=compartment_id, resource_type=resource_type, **kwargs |
| 189 | + ) |
| 190 | + ) |
| 191 | + |
178 | 192 | def get_shape_availability(self, **kwargs): |
179 | 193 | """For a given compartmentId, resource limit name, and scope, returns the number of available resources associated |
180 | 194 | with the given limit.""" |
181 | 195 | compartment_id = self.get_argument("compartment_id", default=COMPARTMENT_OCID) |
182 | 196 | instance_shape = self.get_argument("instance_shape") |
| 197 | + limit_name = self.get_argument("limit_name") |
183 | 198 |
|
184 | 199 | return self.finish( |
185 | 200 | AquaUIApp().get_shape_availability( |
186 | | - compartment_id=compartment_id, instance_shape=instance_shape, **kwargs |
| 201 | + compartment_id=compartment_id, |
| 202 | + instance_shape=instance_shape, |
| 203 | + limit_name=limit_name, |
| 204 | + **kwargs, |
187 | 205 | ) |
188 | 206 | ) |
189 | 207 |
|
@@ -244,6 +262,7 @@ def post(self, *args, **kwargs): |
244 | 262 | ("job/shapes/?([^/]*)", AquaUIHandler), |
245 | 263 | ("vcn/?([^/]*)", AquaUIHandler), |
246 | 264 | ("subnets/?([^/]*)", AquaUIHandler), |
| 265 | + ("privateendpoints/?([^/]*)", AquaUIHandler), |
247 | 266 | ("shapes/limit/?([^/]*)", AquaUIHandler), |
248 | 267 | ("bucket/versioning/?([^/]*)", AquaUIHandler), |
249 | 268 | ("containers/?([^/]*)", AquaUIHandler), |
|
0 commit comments