Skip to content

Commit a285340

Browse files
1101-1aquamatthias
andauthored
[gcp][feat] Add Vertex AI collection (#2211)
Co-authored-by: Matthias Veit <aquamatthias@users.noreply.github.com>
1 parent 06ff0a3 commit a285340

File tree

5 files changed

+3394
-9
lines changed

5 files changed

+3394
-9
lines changed

plugins/gcp/fix_plugin_gcp/collector.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from fix_plugin_gcp.config import GcpConfig
66
from fix_plugin_gcp.gcp_client import GcpApiSpec
7-
from fix_plugin_gcp.resources import compute, container, billing, sqladmin, storage
7+
from fix_plugin_gcp.resources import compute, container, billing, sqladmin, storage, aiplatform
88
from fix_plugin_gcp.resources.base import GcpResource, GcpProject, ExecutorQueue, GraphBuilder, GcpRegion, GcpZone
99
from fix_plugin_gcp.utils import Credentials
1010
from fixlib.baseresources import Cloud
@@ -13,7 +13,12 @@
1313

1414
log = logging.getLogger("fix.plugins.gcp")
1515
all_resources: List[Type[GcpResource]] = (
16-
compute.resources + container.resources + billing.resources + sqladmin.resources + storage.resources
16+
compute.resources
17+
+ container.resources
18+
+ billing.resources
19+
+ sqladmin.resources
20+
+ storage.resources
21+
+ aiplatform.resources
1722
)
1823

1924

plugins/gcp/fix_plugin_gcp/gcp_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class GcpApiSpec:
3030
response_path: str
3131
response_regional_sub_path: Optional[str] = None
3232
set_label_identifier: str = "resource"
33+
service_with_region_prefix: bool = False
3334
get_identifier: Optional[str] = None
3435
delete_identifier: Optional[str] = None
3536
required_iam_permissions: Optional[List[str]] = None
@@ -178,6 +179,8 @@ def next_responses(request: Any) -> None:
178179
):
179180
return next_responses(nxt_req)
180181

182+
if api_spec.service_with_region_prefix and isinstance(executor._baseUrl, str):
183+
executor._baseUrl = executor._baseUrl.replace(api_spec.service, f"{self.region}-{api_spec.service}", 1)
181184
next_responses(getattr(executor, api_spec.action)(**params))
182185
return result
183186

0 commit comments

Comments
 (0)