Skip to main content

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.

tip

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

FieldRequiredTypeDescription
serverNameYesStringService name
versionFlowItemsNoArray<ICloudBaseRunVersionFlowItem>Traffic percentage

ICloudBaseRunVersionFlowItem

FieldRequiredTypeDescription
versionNameYesStringVersion name
flowRatioYesNumberTraffic percentage

3. Response

FieldRequiredTypeDescription
RequestIdYesStringRequest unique identifier
ResultYesStringResult, '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();