HEI
HEI
HEI资源类(Http Event Ingestion), 能够在炎凰数据平台中创建一个http的service endpoint和一系列token, 用户可以通过向这个endpoint发送请求并附上token导入数据到炎凰数据平台中。
示例 1:
const dataIngestionService = ServiceManager.getService('data'); const hei = new HEI(); hei.init(dataIngestionService, 'hei_name'); // 获取hei的属性 hei.fetch().then(() => {})
成员函数:
disable() → {Promise}
禁用此HEI endpoint
示例:
hei.disable().then(() => { // do something console.log('hei is disabled') })
enable() → {Promise}
启用此HEI endpoint
示例:
hei.enable().then(() => { // do something console.log('hei is enabled') })
createAPIToken(options: object) → {Promise}
颁发一个新的token
参数:
参数名称 | 参数类型 | 描述 |
---|---|---|
options | object | 创建api token的参数
|
示例:
hei.createAPIToken({ lifeTime: 3600 }).then((response) => { const { token } = response; // do something using token })
HEIs
HEI资源类(Http Event Ingestion)列表,能够获取HEI列表,或者创建HEI资源。
成员函数:
getAPIToken(heiId: string) → {Promise}
获取某个HEI的token值
参数:
参数名称 | 参数类型 | 描述 |
---|---|---|
heiId | string | 想要获取的HEI Endpoint的id,注意不是name,是ID |
示例:
const heiCollection = dataIngestionService.HEIs(); heiCollection.getAPIToken('81129992-ae88-507d-b3c9-7a059ae9c39e').then((response) => {});
updateAPIToken(heiID: string, options: object) → {Promise}
重新颁发一个token,以及起lifeSpan
参数:
参数名称 | 参数类型 | 描述 |
---|---|---|
heiID | string | 所需要更新的HEI的ID |
options | object | 配置项
|
示例:
const heiCollection = dataIngestionService.HEIs(); heiCollection.updateAPIToken('81129992-ae88-507d-b3c9-7a059ae9c39e', { lifeTime: 3600 }).then((response) => {});