Skip to content

Commit 7909ead

Browse files
feat(apigateway) fix split error and update README
1 parent 0f3a5a9 commit 7909ead

2 files changed

Lines changed: 18 additions & 13 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ CloudGraph GCP Provider will ask you what regions you would like to crawl and wi
6565
| Service | Relations |
6666
| ------------------------------------- | -------------------------------------------------------------------------------- |
6767
| alertPolicy | project |
68+
| apiGatewayGateways | project, apiGatewayApis, apiGatewayApiConfigs |
69+
| apiGatewayApis | project, apiGatewayGateways |
70+
| apiGatewayApiConfigs | project, apiGatewayGateways |
6871
| apiKeys | project |
6972
| assets | project |
7073
| bigQueryDataset | project |

src/services/apiGatewayApiConfig/data.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,22 @@ export default async ({
4949

5050
try {
5151
for await (const api of apis) {
52-
const apiIdSessions = api.id.split('/')
53-
const apiName = apiIdSessions[apiIdSessions.length - 1]
54-
const apiConfigIter = apiGatewayClient.listApiConfigsAsync({
55-
parent: `projects/${projectId}/locations/${GLOBAL_REGION}/apis/${apiName}`,
56-
})
57-
58-
for await (const {name, labels, ...apiConfig} of apiConfigIter) {
59-
routerData.push({
60-
id: name,
61-
projectId,
62-
region: GLOBAL_REGION,
63-
Labels: labels,
64-
...apiConfig,
52+
const apiIdSessions = api?.id?.split('/') || []
53+
if (!isEmpty(apiIdSessions)) {
54+
const apiName = apiIdSessions[apiIdSessions.length - 1]
55+
const apiConfigIter = apiGatewayClient.listApiConfigsAsync({
56+
parent: `projects/${projectId}/locations/${GLOBAL_REGION}/apis/${apiName}`,
6557
})
58+
59+
for await (const {name, labels, ...apiConfig} of apiConfigIter) {
60+
routerData.push({
61+
id: name,
62+
projectId,
63+
region: GLOBAL_REGION,
64+
Labels: labels,
65+
...apiConfig,
66+
})
67+
}
6668
}
6769
}
6870
} catch (error) {

0 commit comments

Comments
 (0)