- add - Add or update datasource
- retrieveConfig - Get datasource config
Add or update a custom datasource and its schema.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.*;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1AdddatasourceResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
CustomDatasourceConfig req = CustomDatasourceConfig.builder()
.name("<value>")
.urlRegex("https://example-company.datasource.com/.*")
.quicklinks(List.of(
Quicklink.builder()
.iconConfig(IconConfig.builder()
.color("#343CED")
.key("person_icon")
.iconType(IconType.GLYPH)
.name("user")
.build())
.build()))
.build();
PostApiIndexV1AdddatasourceResponse res = sdk.indexing().datasources().add()
.request(req)
.call();
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
CustomDatasourceConfig | ✔️ | The request object to use for the request. |
PostApiIndexV1AdddatasourceResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Fetches the datasource config for the specified custom datasource.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.GetDatasourceConfigRequest;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdatasourceconfigResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
GetDatasourceConfigRequest req = GetDatasourceConfigRequest.builder()
.datasource("<value>")
.build();
PostApiIndexV1GetdatasourceconfigResponse res = sdk.indexing().datasources().retrieveConfig()
.request(req)
.call();
if (res.customDatasourceConfig().isPresent()) {
// handle response
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
GetDatasourceConfigRequest | ✔️ | The request object to use for the request. |
PostApiIndexV1GetdatasourceconfigResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |