acm-client
Aliyun acm client for Node.js. 阿里云 acm Node.js 客户端 https://help.aliyun.com/document_detail/60137.html
Install
$ npm i acm-client --save
Usage
const ACMClient = ;const acm = endpoint: 'acm.aliyun.com' // acm 控制台查看 namespace: '***************' // acm 控制台查看 accessKey: '***************' // acm 控制台查看 secretKey: '***************' // acm 控制台查看 requestTimeout: 6000 // 请求超时时间,默认6s; // 主动拉取配置; // 监听数据更新acm; // 发布配置接口; // 删除配置; // 批量获取配置; // 获取所有配置;
Error Events 异常处理
acm;
API
获取配置
function* getConfig(dataId, group)
- {String} dataId - 配置id
- {String} group - 配置分组
发布配置
function* publishSingle(dataId, group, content)
- {String} dataId - 配置id
- {String} group - 配置分组
- {String} content - 发布内容
删除配置
function* remove(dataId, group)
- {String} dataId - 配置id
- {String} group - 配置分组
批量获取多个配置
function* batchGetConfig(dataIds, group)
- {Array} dataIds - 配置id
- {String} group - 配置分组
订阅配置
function subscribe(info, listener)
- {Object} info
- {String} dataId - 配置id
- {String} group - 配置分组
- {Function} listener - 回调函数
- {Object} info
取消订阅
function unSubscribe(info, [listener])
- {Object} info
- {String} dataId - 配置id
- {String} group - 配置分组
- {Function} listener - 回调函数(可选,不传就移除所有监听函数)
- {Object} info
获取所有配置
function getConfigs()
该接口不返回配置的具体内容,拿到配置信息后请再调用getConfig
获取配置内容