Cloud Application
Serverless Cloud App is a serverless container service provided by Cloud Development. Users can utilize it through various methods such as code/images. There is no need to maintain complex container environments, allowing users to focus on their own business. After one-click activation, they can enjoy container resources that automatically scale in and out. In Serverless Cloud App, users can also access other corresponding development capabilities and SDK provided by Cloud Development, as well as the built-in default domain name for server-side business access.
All the following interfaces were added in version 3.6.0+.
Adjust Service Version Traffic Configuration
1. Interface Description
Function: Adjust service version traffic configuration.
Interface declaration: async modifyServerFlow(options: IModifyServerFlowOption)
2. Input Parameters
Field | Required | Type | Description |
---|---|---|---|
serverName | Yes | String | Service name |
versionFlowItems | No | Array<ICloudBaseRunVersionFlowItem> | Traffic percentage |
ICloudBaseRunVersionFlowItem
Field | Required | Type | Description |
---|---|---|---|
versionName | Yes | String | Version name |
flowRatio | Yes | Number | Traffic percentage |
3. Response
Field | Required | Type | Description |
---|---|---|---|
RequestId | Yes | String | Request unique identifier |
Result | Yes | String | Result, 'succ' represents success |
4. Sample Code
import CloudBase from "@cloudbase/manager-node";
const app = new CloudBase({
secretId: "Your SecretId",
secretKey: "Your SecretKey",
envId: "Your envId" // CloudBase environment ID, obtain from the Tencent CloudBase Console
});
async function test() {
const res = await app.cloudApp.modifyServerFlow({
serverName: "test",
versionFlowItems: [
{
versionName: "test-001",
flowRatio: 30
},
{
versionName: "test-002",
flowRatio: 70
}
]
});
const { Result } = res;
console.log(Result === "succ");
}
test();