0.1.2 • Published 6 years ago

dynamic-slb-weight v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Gray release

预发布-灰度策略

Install

npm i dynamic-slb-weight --save

Usage

token

{
    "AccessKeyId": "your AccessKeyId",
    "AccessSecret": "your AccessSecret"
}

App Options

{
    "Url": "http://slb.aliyuncs.com",
    "RegionId": "your RegionId",
    "LoadBalancerId": "your LoadBalancerId",
    "BackendServers": [
        {
            "ServerId": "your ECS ServerId-1",
            "Weight": 0,
            "Type": "ecs"
        },
        {
            "ServerId": "your ECS ServerId-2",
            "Weight": 0,
            "Type": "ecs"
        }
    ]
}

实例化预发布服务器

const App = require('dynamic-slb-weight')
const app = new App(token, options)

推荐api

// 启用预发布
let res = await app.startPreviewServers()

// 修改预发布服务器权重
let res = await app.setPreviewServersWeight(100)

// 停止预发布服务器
let res = await app.stopPreviewServers()

// 查询预发布服务器信息
let res = await app.getInfomation()

非必须api

// 添加预发布服务器到SLB
let res = await app.addPreviewServers()

// 从SLB删除预发布服务器
let res = await app.removePreviewServers()

返回值res: Result
code 请求状态标记,0表示成功,非0表示失败
message 失败信息
data code为0时必须,非0时可选,具体返回值结构体可参考阿里云api说明文档

{
    code: 0,
    message: 'ok',
    data: {}
}