JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1472
  • Score
    100M100P100Q125356F
  • License MIT

Tencent cloud faas sdk

Package Exports

  • @tencent-sdk/faas

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tencent-sdk/faas) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Tencent Cloud FaaS SDK

This is a SDK tool for Tencent Cloud FaaS service.

Installation

$ npm i @tencent-sdk/faas --save
# or
$ yarn add @tencent-sdk/faas

Usage

FaaS is the only class for create a client request instance. You can use it like below:

import { FaaS } from '@tencent-sdk/faas';

const client = new FaaS({
  secretId: 'Please input your SecretId',
  secretKey: 'Please input your SecretKey',
  token: 'Please input your Token',
  region: 'ap-guangzhou',
  debug: false,
});

Support methods:

getRegion

Get current region config:

const region = client.getRegion();

setRegion

Config service region:

client.setRegion('ap-guangzhou');

invoke

Invoke faas:

const res = await faas.invoke({
  name: 'serverless-test',
  namespace: 'default',
  qualifier: '$LATEST',
});

getClsConfig

Get CLS config:

const res = await faas.getClsConfig({
  name: 'serverless-test',
  namespace: 'default',
  qualifier: '$LATEST',
});

getLogList

Get log list:

const res = await faas.getLogList({
  name: 'serverless-test',
  namespace: 'default',
  qualifier: '$LATEST',
});

Notice: Default in 1 hour

getLogDetail

Create log detail by request id:

const res = await faas.getLogDetail({
  name: 'serverless-test',
  namespace: 'default',
  qualifier: '$LATEST',
  logsetId: 'xxx-xxx',
  topicId: 'xxx-xxx',
  reqId: 'xxx-xxx',
});

getLogByReqId

Get topic:

const res = await faas.getLogByReqId({
  name: 'serverless-test',
  namespace: 'default',
  qualifier: '$LATEST',
  reqId: 'xxx-xxx',
});

Options

const client = new FaaS(FaasOptions);

FaasOptions for FaaS Construct

Name Description Type Required Default
secretId tencent account secret id string true ''
secretKey tencent account secret key string true ''
token tencent account token string false ''
region request region string true ap-guangzhou
debug whether enable log debug info boolean false false

License

MIT