github.com/morlay/goqcloud@v0.0.0-20181123023149-b00e0b0b9afc/clients/scf/invoke.go (about)

     1  package scf
     2  
     3  import (
     4  	github_com_morlay_goqcloud "github.com/morlay/goqcloud"
     5  )
     6  
     7  // 运行函数
     8  // https://cloud.tencent.com/document/api/583/17243
     9  
    10  type InvokeRequest struct {
    11  	// 运行函数时的参数,以json格式传入,最大支持的参数长度是 1M
    12  	ClientContext *string `name:"ClientContext,omitempty"`
    13  	// 函数名称
    14  	FunctionName string `name:"FunctionName"`
    15  	// RequestResponse(同步) 和 Event(异步),默认为同步
    16  	InvocationType *string `name:"InvocationType,omitempty"`
    17  	// 同步调用时指定该字段,返回值会包含4K的日志,可选值为None和Tail,默认值为None。当该值为Tail时,返回参数中的logMsg字段会包含对应的函数执行日志
    18  	LogType *string `name:"LogType,omitempty"`
    19  	// 命名空间
    20  	Namespace *string `name:"Namespace,omitempty"`
    21  	// 触发函数的版本号
    22  	Qualifier *string `name:"Qualifier,omitempty"`
    23  	// 区域
    24  	Region string `name:"Region"`
    25  }
    26  
    27  func (req *InvokeRequest) Invoke(client github_com_morlay_goqcloud.Client) (*InvokeResponse, error) {
    28  	resp := &InvokeResponse{}
    29  	err := client.Request("scf", "Invoke", "2018-04-16").Do(req, resp)
    30  	return resp, err
    31  }
    32  
    33  type InvokeResponse struct {
    34  	github_com_morlay_goqcloud.TencentCloudBaseResponse
    35  	// 函数执行结果
    36  	Result Result `json:"Result"`
    37  }