From 5aa5283152a799ed37c15e5bdbb71cec9ce17110 Mon Sep 17 00:00:00 2001 From: Eric Roberson Date: Thu, 13 Mar 2025 18:30:24 -0700 Subject: [PATCH] docs: fix example location annotations in incrementalentityprovider Signed-off-by: Eric Roberson --- docs/features/software-catalog/external-integrations.md | 9 ++++++--- .../README.md | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/features/software-catalog/external-integrations.md b/docs/features/software-catalog/external-integrations.md index 343128bfbf..915726eb6c 100644 --- a/docs/features/software-catalog/external-integrations.md +++ b/docs/features/software-catalog/external-integrations.md @@ -1161,9 +1161,11 @@ export class MyIncrementalEntityProvider implements IncrementalEntityProvider { private readonly token: string; + private readonly mySource: string; - constructor(token: string) { + constructor(token: string, mySource: string) { this.token = token; + this.mySource = mySource; } getProviderName() { @@ -1181,6 +1183,7 @@ export class MyIncrementalEntityProvider cursor: Cursor = { page: 1 }, ): Promise> { const { apiClient } = context; + const location = `${this.getProviderName()}:${mySource}`; // call your API with the current cursor const data = await apiClient.getServices(cursor); @@ -1200,8 +1203,8 @@ export class MyIncrementalEntityProvider name: item.name, annotations: { // You need to define these, otherwise they'll fail validation - [ANNOTATION_LOCATION]: this.getProviderName(), - [ANNOTATION_ORIGIN_LOCATION]: this.getProviderName(), + [ANNOTATION_LOCATION]: location, + [ANNOTATION_ORIGIN_LOCATION]: location, }, }, spec: { diff --git a/plugins/catalog-backend-module-incremental-ingestion/README.md b/plugins/catalog-backend-module-incremental-ingestion/README.md index 2535fbe8e3..ee47d759b9 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/README.md +++ b/plugins/catalog-backend-module-incremental-ingestion/README.md @@ -211,9 +211,11 @@ The last step is to implement the actual `next` method that will accept the curs export class MyIncrementalEntityProvider implements IncrementalEntityProvider { token: string; + mySource: string; - constructor(token: string) { + constructor(token: string, mySource: string) { this.token = token; + this.mySource = mySource; } getProviderName() { @@ -230,6 +232,7 @@ export class MyIncrementalEntityProvider implements IncrementalEntityProvider> { const { apiClient } = context; + const location = `${this.getProviderName()}:${mySource}`; // call your API with the current cursor const data = await apiClient.getServices(cursor); @@ -249,8 +252,8 @@ export class MyIncrementalEntityProvider implements IncrementalEntityProvider