0.0.2 • Published 4 years ago

tss-api-gw v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Tencent Api Gateway

Tencent Api Gateway api tools.

ApiGwRequest Instance Options

NameDescriptionTypeRequiredDefault
Regionrequest regionstringtrueap-guangzhou
SecretIdtencent account secret idstringtrue''
SecretKeytencenttencent account secret keystringtrue''
debugwhether enable log debug infobooleanfalsefalse
hostrequest hoststringfalsefalse
baseHostrequest domainstringfalse'api.qcloud.com'
pathrequest pathstringfalse'/'
methodrequest methodstringfalse'POST'
protocolrequest protocolstringfalse'https'
SignatureMethodrequest signaturestringfalse'sha1'

Suppper Apis

CreateService

Delete api gateway service

Request Parameters

NameRequiredTypeDescription
serviceNamefalseStringUser customize service name, if not set, system will auto generate an unique name
serviceDescfalseStringUser customize service description
protocoltrueStringService protocal for frontend request using

DeleteService

Delete api gateway service

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID

DescribeService

Gdt api gateway service detail

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID

ReleaseService

Release api gateway service

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID
environmentNametrueBooleanReleasing evironment name, support values: test,prepub,release
unReleaseDesctrueStringunrelease description

UnReleaseService

Unrelease api gateway service

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID
environmentNametrueBooleanReleasing evironment name, support values: test,prepub,release
releaseDesctrueStringrelease description

DescribeService

Gdt api gateway service detail

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID

CreateApi

Create api interface

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID
serviceTypetrueBooleanBackend api service type, support values:HTTP、MOCK、SCF.
serviceTimeouttrueIntService timeout value, unit: second
apiNamefalseStringUser customize api name, if not set, it will be created automatically
apiDescfalseStringUser customize api description
apiTypefalseStringApi type
authRequiredfalseStringwhether need authentication or not. Default is true. If want to open to cloud market, must be true
enableCORSfalseStringWhether enable CORS, default is false
requestConfig.pathtrueStringRequest path
requestConfig.methodtrueStringRequest method
requestParametersfalserequestParameter[]Frontend api request parameters
serviceConfig.urlfalseStringRequest url. When serviceType is HTTP, this parameter is required
serviceConfig.pathfalseStringRequest path, like /path. When serviceType is HTTP, this parameter is required
serviceConfig.methodfalseStringRequest method. When serviceType is HTTP, this parameter is required
serviceParametersfalseserviceParameter[]Api service parameter name. When serviceType is HTTP, this parameter is required.
constantParametersfalseconstantParameter[]Constant parameter name. When serviceType is HTTP, this parameter is required.
serviceMockReturnMessagefalseStringBackend api service mock return. When serviceType is MOCK, this parameter is required.
serviceScfFunctionNamefalseStringSCF function name for backend api service. When serviceType is SCF, this parameter is required.
serviceScfIsIntegratedResponsefalseStringWhether enable SCF integrated response. When serviceType is SCF, this parameter is required. Default is false
serviceScfFunctionQualifierfalseStringSCF function version, default is $LATEST.
responseTypefalseStringCustomize response return type. Support values: HTML、JSON、TEST、BINARY、XML.(This option is only for generate API document.)
responseSuccessExamplefalseStringCustomize success response example. (This option is only for generate API document.)
responseFailExamplefalseStringCustomize fail response example. (This option is only for generate API document.)
responseErrorCodesfalseresponseErrorCode[]Customize error response code. (This option is only for generate API document.)

requestParameter

NameRequiredTypeDescription
namefalseStringFrontend api request name
positionfalseStringFrontend api request position, support values: PATH,QUERY,HEADER.
typefalseStringFrontend api parameter type,eg: String,Int.
defaultValuefalseStringFrontend api parameter default value
requiredfalseBooleanWhether this frontend api parameter is requested
descfalseStringFrontend api request paremter remarks

serviceParameter

NameRequiredTypeDescription
namefalseStringApi service parameter name. When serviceType is HTTP, this parameter is required.
positionfalseStringApi service parameter position, like head. When serviceType is HTTP, this parameter is required.
relevantRequestParameterNamefalseStringBackend service parameter maps to frontend parameter name. When serviceType is HTTP, this parameter is required.
relevantRequestParameterPositionfalseStringBackend service parameter maps to frontend parameter position. When serviceType is HTTP, this parameter is required.
descfalseStringBackend api service description. When serviceType is HTTP, this parameter is required.

constantParameter

NameRequiredTypeDescription
namefalseStringConstant parameter name. When serviceType is HTTP, this parameter is required.
descfalseStringConstant parameter description. When serviceType is HTTP, this parameter is required.
positionfalseStringConstant parameter position. Support values: header,query. When serviceType is HTTP, this parameter is required.
defaultValuefalseStringConstant parameter default value. When serviceType is HTTP, this parameter is required.

responseErrorCode

NameRequiredTypeDescription
codefalseIntCustomize error response code. (This option is only for generate API document.)
msgfalseStringCustomize error response message. (This option is only for generate API document.)
descfalseStringCustomize error response description. (This option is only for generate API document.)

ModifyApi

Modify api interface

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID
serviceTypetrueBooleanBackend api service type, support values:HTTP、MOCK、SCF.
serviceTimeouttrueIntService timeout value, unit: second
apiIdtrueStringApi ID
apiNamefalseStringUser customize api name, if not set, it will be created automatically
apiDescfalseStringUser customize api description
apiTypefalseStringApi type
authRequiredfalseStringwhether need authentication or not. Default is true. If want to open to cloud market, must be true
enableCORSfalseStringWhether enable CORS, default is false
requestConfig.pathtrueStringRequest path
requestConfig.methodtrueStringRequest method
requestParametersfalserequestParameter[]Frontend api request parameters
serviceConfig.urlfalseStringRequest url. When serviceType is HTTP, this parameter is required
serviceConfig.pathfalseStringRequest path, like /path. When serviceType is HTTP, this parameter is required
serviceConfig.methodfalseStringRequest method. When serviceType is HTTP, this parameter is required
serviceParametersfalseserviceParameter[]Api service parameter name. When serviceType is HTTP, this parameter is required.
constantParametersfalseconstantParameter[]Constant parameter name. When serviceType is HTTP, this parameter is required.
serviceMockReturnMessagefalseStringBackend api service mock return. When serviceType is MOCK, this parameter is required.
serviceScfFunctionNamefalseStringSCF function name for backend api service. When serviceType is SCF, this parameter is required.
serviceScfIsIntegratedResponsefalseStringWhether enable SCF integrated response. When serviceType is SCF, this parameter is required. Default is false
serviceScfFunctionQualifierfalseStringSCF function version, default is $LATEST.
responseTypefalseStringCustomize response return type. Support values: HTML、JSON、TEST、BINARY、XML.(This option is only for generate API document.)
responseSuccessExamplefalseStringCustomize success response example. (This option is only for generate API document.)
responseFailExamplefalseStringCustomize fail response example. (This option is only for generate API document.)
responseErrorCodesfalseresponseErrorCode[]Customize error response code. (This option is only for generate API document.)

DescribeApi

Get api interface detail

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID
apiIdtrueStringApi ID

DeleteApi

Delete api interface detail

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID
apiIdtrueStringApi ID

DescribeApisStatus

Delete api interface detail

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID
apiIdsfalseString[]Array of Api ID
offsetfalseIntQuery offset, default is 0.
limitfalseIntQuery length, default is 20, max is 100.
orderbyfalseStringOrder by field.
orderfalseStringOrder method, support values: asc,desc.
searchNamefalseStringFuzzy search by api path name
searchIdfalseStringAccurate search by api id

CreateUsagePlan

Create usage plan

Request Parameters

NameRequiredTypeDescription
usagePlanNamefalseStringusage plan name
usagePlanDescfalseStringusage plan description
maxRequestNumPreSecfalseIntmax request number per second, default is 1000
maxRequestNumfalseIntMax request number, -1 represent no limit for request number.

ModifyUsagePlan

Modify usage plan

Request Parameters

NameRequiredTypeDescription
usagePlanIdtrueStringusage plan id
usagePlanNamefalseStringusage plan name
usagePlanDescfalseStringusage plan description
maxRequestNumPreSecfalseIntmax request number per second, default is 1000
maxRequestNumfalseIntMax request number, -1 represent no limit for request number.

DescribeUsagePlan

Get usage plan detail

Request Parameters

NameRequiredTypeDescription
usagePlanIdtrueStringusage plan id

DeleteUsagePlan

Delete usage plan detail

Request Parameters

NameRequiredTypeDescription
usagePlanIdtrueStringusage plan id

DescribeUsagePlanSecretIds

Get Secrete Ids of usage plan

Request Parameters

NameRequiredTypeDescription
usagePlanIdtrueStringusage plan id
limitfalseIntQuery length
offsetfalseIntQuery offset

DescribeApiUsagePlan

Get usage plan detail of api service

Request Parameters

NameRequiredTypeDescription
serviceIdtrueStringService ID
apiIdsfalseString[]Array of Api ID
offsetfalseIntQuery offset, default is 0.
limitfalseIntQuery length, default is 20, max is 100.
searchEnvironmentfalseStringAccurate search by environment name of usage plan.

BindSecretIds

Bind secret key for usage plan

Request Parameters

NameRequiredTypeDescription
usagePlanIdtrueStringusage plan id
secretIdstrueString[]Array of secret id

UnBindSecretIds

Unbind secret key for usage plan

Request Parameters

NameRequiredTypeDescription
usagePlanIdtrueStringusage plan id
secretIdstrueString[]Array of secret id

BindEnvironment

Bind service environment for usage plan

Request Parameters

NameRequiredTypeDescription
usagePlanIdstrueString[]Array of usage plan id
secretIdstrueString[]Array of secret id
environmenttrueStringService enviroment(service id / api id)
bindTypefalseStringBind type, support values: API, SERVICE. Default is SERVICE。
apiIdsfalseString[]Array of app id, when bindType is 'API', it's required

UnBindEnvironment

UnBind service environment for usage plan

Request Parameters

NameRequiredTypeDescription
usagePlanIdstrueString[]Array of usage plan id
secretIdstrueString[]Array of secret id
environmenttrueStringService enviroment(service id / api id)
bindTypefalseStringBind type, support values: API, SERVICE. Default is SERVICE。
apiIdsfalseString[]Array of app id, when bindType is 'API', it's required

CreateApiKey

Create api secret key

Request Parameters

NameRequiredTypeDescription
secretNamefalseStringCustomize secret name用户自定义密钥名称。
secretIdfalseStringCustomize secret id. When type is manual, it's required. Regular: [0-9a-zA-Z_]{5, 50}
secretKeyfalseStringCustomize secret key. When type is manual, it's required. Regular: [0-9a-zA-Z_]{10, 50}
typefalseStringSecret type. Support value: auto, manual, default is auto

DeleteApiKey

Delete api secret key

Request Parameters

NameRequiredTypeDescription
secretIdfalseStringsecret id

DisableApiKey

Disable api secret key

Request Parameters

NameRequiredTypeDescription
secretIdfalseStringsecret id

EnableApiKey

Enable api secret key

Request Parameters

NameRequiredTypeDescription
secretIdfalseStringsecret id

DescribeApiKeysStatus

Get api secret key list

Request Parameters

NameRequiredTypeDescription
secretIdsfalseString[]secret id
offsetfalseIntQuery offset, default is 0.
limitfalseIntQuery length, default is 20, max is 100.
orderbyfalseStringOrder by field.
orderfalseStringOrder method, support values: asc,desc.
searchNamefalseStringFuzzy search by secret name
searchIdfalseStringAccurate search by secret id