Skip to content

Latest commit

 

History

History
125 lines (88 loc) · 5.48 KB

File metadata and controls

125 lines (88 loc) · 5.48 KB

Indexing.Datasources

Overview

Available Operations

add

Add or update a custom datasource and its schema.

Example Usage

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
    }
}

Parameters

Parameter Type Required Description
request CustomDatasourceConfig ✔️ The request object to use for the request.

Response

PostApiIndexV1AdddatasourceResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

retrieveConfig

Fetches the datasource config for the specified custom datasource.

Example Usage

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
        }
    }
}

Parameters

Parameter Type Required Description
request GetDatasourceConfigRequest ✔️ The request object to use for the request.

Response

PostApiIndexV1GetdatasourceconfigResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*