add the fucnction of deletefunction

This commit is contained in:
liyaojie 2023-07-18 15:48:35 +08:00
parent 45b389e051
commit 1a04f3ae37
6 changed files with 428 additions and 67 deletions

View File

@ -0,0 +1,67 @@
package logic
import (
"context"
"fmt"
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
"PCM/adaptor/PCM-FC/PCM-SCF/internal/svc"
"PCM/adaptor/PCM-FC/PCM-SCF/scf"
"PCM/common/tool"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
tscf "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteFunctionsLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteFunctionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteFunctionsLogic {
return &DeleteFunctionsLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// DeleteFunctions 删除腾讯云函数
func (l *DeleteFunctionsLogic) DeleteFunctions(in *scf.DeleteFunctionsReq) (*scf.DeleteFunctionsResp, error) {
// todo: add your logic here and delete this line
resp := &scf.DeleteFunctionsResp{}
// 实例化要请求产品的client对象,clientProfile是可选的k
client, _ := tscf.NewClient(l.svcCtx.Credential, "*************", l.svcCtx.Cpf)
// 实例化一个请求对象,每个接口都会对应一个request对象
request := tscf.NewDeleteFunctionRequest()
request.FunctionName = common.StringPtr(in.FunctionName)
if in.Namespace != "" {
request.Namespace = common.StringPtr(in.Namespace)
}
if in.Qualifier != "" {
request.Qualifier = common.StringPtr(in.Qualifier)
}
response, err := client.DeleteFunction(request)
// 返回的resp是一个DeleteFunctionResponse的实例与请求对象对应
if _, ok := err.(*errors.TencentCloudSDKError); ok {
fmt.Printf("An API error has returned: %s", err)
return nil, nil
}
if err != nil {
panic(err)
}
// 输出json格式的字符串回包
fmt.Printf("%s", response.ToJsonString())
tool.Convert(response.Response, &resp.Response)
return resp, nil
}

View File

@ -33,3 +33,9 @@ func (s *ScfServer) GetFunctions(ctx context.Context, in *scf.GetFunctionsReq) (
l := logic.NewGetFunctionsLogic(ctx, s.svcCtx)
return l.GetFunctions(in)
}
// DeleteFunctions 删除腾讯云函数
func (s *ScfServer) DeleteFunctions(ctx context.Context, in *scf.DeleteFunctionsReq) (*scf.DeleteFunctionsResp, error) {
l := logic.NewDeleteFunctionsLogic(ctx, s.svcCtx)
return l.DeleteFunctions(in)
}

View File

@ -211,6 +211,21 @@ message ListFunctionsResponse {
int32 totalCount = 3;
}
message DeleteFunctionsReq{
string FunctionName = 1;
string Namespace = 2;
string Qualifier = 3;
}
message DeleteFunctionsResp{
DeleteFunctionsResponse Response = 1;
}
message DeleteFunctionsResponse {
string RequestId = 1;
}
// scf
service Scf {
@ -221,4 +236,8 @@ service Scf {
//GetFunctions
rpc GetFunctions(GetFunctionsReq) returns (GetFunctionsResp);
//DeleteFunctions
rpc DeleteFunctions(DeleteFunctionsReq) returns (DeleteFunctionsResp);
}

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.30.0
// protoc v4.23.4
// protoc-gen-go v1.31.0
// protoc v3.19.4
// source: pb/pcm-scf.proto
package scf
@ -2036,6 +2036,163 @@ func (x *ListFunctionsResponse) GetTotalCount() int32 {
return 0
}
type DeleteFunctionsReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
FunctionName string `protobuf:"bytes,1,opt,name=FunctionName,proto3" json:"FunctionName,omitempty"`
Namespace string `protobuf:"bytes,2,opt,name=Namespace,proto3" json:"Namespace,omitempty"`
Qualifier string `protobuf:"bytes,3,opt,name=Qualifier,proto3" json:"Qualifier,omitempty"`
}
func (x *DeleteFunctionsReq) Reset() {
*x = DeleteFunctionsReq{}
if protoimpl.UnsafeEnabled {
mi := &file_pb_pcm_scf_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteFunctionsReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteFunctionsReq) ProtoMessage() {}
func (x *DeleteFunctionsReq) ProtoReflect() protoreflect.Message {
mi := &file_pb_pcm_scf_proto_msgTypes[24]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteFunctionsReq.ProtoReflect.Descriptor instead.
func (*DeleteFunctionsReq) Descriptor() ([]byte, []int) {
return file_pb_pcm_scf_proto_rawDescGZIP(), []int{24}
}
func (x *DeleteFunctionsReq) GetFunctionName() string {
if x != nil {
return x.FunctionName
}
return ""
}
func (x *DeleteFunctionsReq) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
func (x *DeleteFunctionsReq) GetQualifier() string {
if x != nil {
return x.Qualifier
}
return ""
}
type DeleteFunctionsResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Response *DeleteFunctionsResponse `protobuf:"bytes,1,opt,name=Response,proto3" json:"Response,omitempty"`
}
func (x *DeleteFunctionsResp) Reset() {
*x = DeleteFunctionsResp{}
if protoimpl.UnsafeEnabled {
mi := &file_pb_pcm_scf_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteFunctionsResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteFunctionsResp) ProtoMessage() {}
func (x *DeleteFunctionsResp) ProtoReflect() protoreflect.Message {
mi := &file_pb_pcm_scf_proto_msgTypes[25]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteFunctionsResp.ProtoReflect.Descriptor instead.
func (*DeleteFunctionsResp) Descriptor() ([]byte, []int) {
return file_pb_pcm_scf_proto_rawDescGZIP(), []int{25}
}
func (x *DeleteFunctionsResp) GetResponse() *DeleteFunctionsResponse {
if x != nil {
return x.Response
}
return nil
}
type DeleteFunctionsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
RequestId string `protobuf:"bytes,1,opt,name=RequestId,proto3" json:"RequestId,omitempty"`
}
func (x *DeleteFunctionsResponse) Reset() {
*x = DeleteFunctionsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_pb_pcm_scf_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteFunctionsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteFunctionsResponse) ProtoMessage() {}
func (x *DeleteFunctionsResponse) ProtoReflect() protoreflect.Message {
mi := &file_pb_pcm_scf_proto_msgTypes[26]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteFunctionsResponse.ProtoReflect.Descriptor instead.
func (*DeleteFunctionsResponse) Descriptor() ([]byte, []int) {
return file_pb_pcm_scf_proto_rawDescGZIP(), []int{26}
}
func (x *DeleteFunctionsResponse) GetRequestId() string {
if x != nil {
return x.RequestId
}
return ""
}
var File_pb_pcm_scf_proto protoreflect.FileDescriptor
var file_pb_pcm_scf_proto_rawDesc = []byte{
@ -2343,7 +2500,23 @@ var file_pb_pcm_scf_proto_rawDesc = []byte{
0x73, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f,
0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0x82, 0x01, 0x0a, 0x03, 0x53, 0x63, 0x66, 0x12, 0x3e, 0x0a,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x74, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46,
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x46,
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0c, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12,
0x1c, 0x0a, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1c, 0x0a,
0x09, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x51, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x4f, 0x0a, 0x13, 0x44,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65,
0x73, 0x70, 0x12, 0x38, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x63, 0x66, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x52, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x0a, 0x17,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x49, 0x64, 0x32, 0xc8, 0x01, 0x0a, 0x03, 0x53, 0x63, 0x66, 0x12, 0x3e, 0x0a,
0x0d, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x15,
0x2e, 0x73, 0x63, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x73, 0x63, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74,
@ -2351,8 +2524,12 @@ var file_pb_pcm_scf_proto_rawDesc = []byte{
0x0c, 0x47, 0x65, 0x74, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x2e,
0x73, 0x63, 0x66, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73, 0x63, 0x66, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x75, 0x6e,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2f, 0x73,
0x63, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x44, 0x0a, 0x0f, 0x44, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x17, 0x2e,
0x73, 0x63, 0x66, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x73, 0x63, 0x66, 0x2e, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70,
0x42, 0x06, 0x5a, 0x04, 0x2f, 0x73, 0x63, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -2367,32 +2544,35 @@ func file_pb_pcm_scf_proto_rawDescGZIP() []byte {
return file_pb_pcm_scf_proto_rawDescData
}
var file_pb_pcm_scf_proto_msgTypes = make([]protoimpl.MessageInfo, 24)
var file_pb_pcm_scf_proto_msgTypes = make([]protoimpl.MessageInfo, 27)
var file_pb_pcm_scf_proto_goTypes = []interface{}{
(*GetFunctionsReq)(nil), // 0: scf.GetFunctionsReq
(*Triggers)(nil), // 1: scf.Triggers
(*Vpcconfig)(nil), // 2: scf.Vpcconfig
(*Variables)(nil), // 3: scf.Variables
(*Environment)(nil), // 4: scf.Environment
(*Tags)(nil), // 5: scf.Tags
(*Eipconfig)(nil), // 6: scf.Eipconfig
(*Accessinfo)(nil), // 7: scf.Accessinfo
(*Layers)(nil), // 8: scf.Layers
(*Deadletterconfig)(nil), // 9: scf.Deadletterconfig
(*Eipconfig1)(nil), // 10: scf.Eipconfig1
(*Publicnetconfig)(nil), // 11: scf.Publicnetconfig
(*Cfsinslist)(nil), // 12: scf.Cfsinslist
(*Cfsconfig)(nil), // 13: scf.Cfsconfig
(*Statusreasons)(nil), // 14: scf.Statusreasons
(*Wsparams)(nil), // 15: scf.Wsparams
(*Protocolparams)(nil), // 16: scf.Protocolparams
(*GetFunctionsResp)(nil), // 17: scf.GetFunctionsResp
(*GetFunctionsResponse)(nil), // 18: scf.GetFunctionsResponse
(*ListFunctionsReq)(nil), // 19: scf.ListFunctionsReq
(*Filters)(nil), // 20: scf.Filters
(*ListFunctionsResp)(nil), // 21: scf.ListFunctionsResp
(*Functions)(nil), // 22: scf.Functions
(*ListFunctionsResponse)(nil), // 23: scf.ListFunctionsResponse
(*GetFunctionsReq)(nil), // 0: scf.GetFunctionsReq
(*Triggers)(nil), // 1: scf.Triggers
(*Vpcconfig)(nil), // 2: scf.Vpcconfig
(*Variables)(nil), // 3: scf.Variables
(*Environment)(nil), // 4: scf.Environment
(*Tags)(nil), // 5: scf.Tags
(*Eipconfig)(nil), // 6: scf.Eipconfig
(*Accessinfo)(nil), // 7: scf.Accessinfo
(*Layers)(nil), // 8: scf.Layers
(*Deadletterconfig)(nil), // 9: scf.Deadletterconfig
(*Eipconfig1)(nil), // 10: scf.Eipconfig1
(*Publicnetconfig)(nil), // 11: scf.Publicnetconfig
(*Cfsinslist)(nil), // 12: scf.Cfsinslist
(*Cfsconfig)(nil), // 13: scf.Cfsconfig
(*Statusreasons)(nil), // 14: scf.Statusreasons
(*Wsparams)(nil), // 15: scf.Wsparams
(*Protocolparams)(nil), // 16: scf.Protocolparams
(*GetFunctionsResp)(nil), // 17: scf.GetFunctionsResp
(*GetFunctionsResponse)(nil), // 18: scf.GetFunctionsResponse
(*ListFunctionsReq)(nil), // 19: scf.ListFunctionsReq
(*Filters)(nil), // 20: scf.Filters
(*ListFunctionsResp)(nil), // 21: scf.ListFunctionsResp
(*Functions)(nil), // 22: scf.Functions
(*ListFunctionsResponse)(nil), // 23: scf.ListFunctionsResponse
(*DeleteFunctionsReq)(nil), // 24: scf.DeleteFunctionsReq
(*DeleteFunctionsResp)(nil), // 25: scf.DeleteFunctionsResp
(*DeleteFunctionsResponse)(nil), // 26: scf.DeleteFunctionsResponse
}
var file_pb_pcm_scf_proto_depIdxs = []int32{
3, // 0: scf.Environment.Variables:type_name -> scf.Variables
@ -2415,15 +2595,18 @@ var file_pb_pcm_scf_proto_depIdxs = []int32{
20, // 17: scf.ListFunctionsReq.filters:type_name -> scf.Filters
23, // 18: scf.ListFunctionsResp.Response:type_name -> scf.ListFunctionsResponse
22, // 19: scf.ListFunctionsResponse.functions:type_name -> scf.Functions
19, // 20: scf.Scf.ListFunctions:input_type -> scf.ListFunctionsReq
0, // 21: scf.Scf.GetFunctions:input_type -> scf.GetFunctionsReq
21, // 22: scf.Scf.ListFunctions:output_type -> scf.ListFunctionsResp
17, // 23: scf.Scf.GetFunctions:output_type -> scf.GetFunctionsResp
22, // [22:24] is the sub-list for method output_type
20, // [20:22] is the sub-list for method input_type
20, // [20:20] is the sub-list for extension type_name
20, // [20:20] is the sub-list for extension extendee
0, // [0:20] is the sub-list for field type_name
26, // 20: scf.DeleteFunctionsResp.Response:type_name -> scf.DeleteFunctionsResponse
19, // 21: scf.Scf.ListFunctions:input_type -> scf.ListFunctionsReq
0, // 22: scf.Scf.GetFunctions:input_type -> scf.GetFunctionsReq
24, // 23: scf.Scf.DeleteFunctions:input_type -> scf.DeleteFunctionsReq
21, // 24: scf.Scf.ListFunctions:output_type -> scf.ListFunctionsResp
17, // 25: scf.Scf.GetFunctions:output_type -> scf.GetFunctionsResp
25, // 26: scf.Scf.DeleteFunctions:output_type -> scf.DeleteFunctionsResp
24, // [24:27] is the sub-list for method output_type
21, // [21:24] is the sub-list for method input_type
21, // [21:21] is the sub-list for extension type_name
21, // [21:21] is the sub-list for extension extendee
0, // [0:21] is the sub-list for field type_name
}
func init() { file_pb_pcm_scf_proto_init() }
@ -2720,6 +2903,42 @@ func file_pb_pcm_scf_proto_init() {
return nil
}
}
file_pb_pcm_scf_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteFunctionsReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pb_pcm_scf_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteFunctionsResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pb_pcm_scf_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteFunctionsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -2727,7 +2946,7 @@ func file_pb_pcm_scf_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pb_pcm_scf_proto_rawDesc,
NumEnums: 0,
NumMessages: 24,
NumMessages: 27,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v4.23.4
// - protoc v3.19.4
// source: pb/pcm-scf.proto
package scf
@ -19,8 +19,9 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
Scf_ListFunctions_FullMethodName = "/scf.Scf/ListFunctions"
Scf_GetFunctions_FullMethodName = "/scf.Scf/GetFunctions"
Scf_ListFunctions_FullMethodName = "/scf.Scf/ListFunctions"
Scf_GetFunctions_FullMethodName = "/scf.Scf/GetFunctions"
Scf_DeleteFunctions_FullMethodName = "/scf.Scf/DeleteFunctions"
)
// ScfClient is the client API for Scf service.
@ -31,6 +32,8 @@ type ScfClient interface {
ListFunctions(ctx context.Context, in *ListFunctionsReq, opts ...grpc.CallOption) (*ListFunctionsResp, error)
// GetFunctions 查询腾讯云云函数详情
GetFunctions(ctx context.Context, in *GetFunctionsReq, opts ...grpc.CallOption) (*GetFunctionsResp, error)
// DeleteFunctions 删除腾讯云函数
DeleteFunctions(ctx context.Context, in *DeleteFunctionsReq, opts ...grpc.CallOption) (*DeleteFunctionsResp, error)
}
type scfClient struct {
@ -59,6 +62,15 @@ func (c *scfClient) GetFunctions(ctx context.Context, in *GetFunctionsReq, opts
return out, nil
}
func (c *scfClient) DeleteFunctions(ctx context.Context, in *DeleteFunctionsReq, opts ...grpc.CallOption) (*DeleteFunctionsResp, error) {
out := new(DeleteFunctionsResp)
err := c.cc.Invoke(ctx, Scf_DeleteFunctions_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ScfServer is the server API for Scf service.
// All implementations must embed UnimplementedScfServer
// for forward compatibility
@ -67,6 +79,8 @@ type ScfServer interface {
ListFunctions(context.Context, *ListFunctionsReq) (*ListFunctionsResp, error)
// GetFunctions 查询腾讯云云函数详情
GetFunctions(context.Context, *GetFunctionsReq) (*GetFunctionsResp, error)
// DeleteFunctions 删除腾讯云函数
DeleteFunctions(context.Context, *DeleteFunctionsReq) (*DeleteFunctionsResp, error)
mustEmbedUnimplementedScfServer()
}
@ -80,6 +94,9 @@ func (UnimplementedScfServer) ListFunctions(context.Context, *ListFunctionsReq)
func (UnimplementedScfServer) GetFunctions(context.Context, *GetFunctionsReq) (*GetFunctionsResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetFunctions not implemented")
}
func (UnimplementedScfServer) DeleteFunctions(context.Context, *DeleteFunctionsReq) (*DeleteFunctionsResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteFunctions not implemented")
}
func (UnimplementedScfServer) mustEmbedUnimplementedScfServer() {}
// UnsafeScfServer may be embedded to opt out of forward compatibility for this service.
@ -129,6 +146,24 @@ func _Scf_GetFunctions_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Scf_DeleteFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteFunctionsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ScfServer).DeleteFunctions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Scf_DeleteFunctions_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ScfServer).DeleteFunctions(ctx, req.(*DeleteFunctionsReq))
}
return interceptor(ctx, in, info, handler)
}
// Scf_ServiceDesc is the grpc.ServiceDesc for Scf service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -144,6 +179,10 @@ var Scf_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetFunctions",
Handler: _Scf_GetFunctions_Handler,
},
{
MethodName: "DeleteFunctions",
Handler: _Scf_DeleteFunctions_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "pb/pcm-scf.proto",

View File

@ -13,36 +13,41 @@ import (
)
type (
Accessinfo = scf.Accessinfo
Cfsconfig = scf.Cfsconfig
Cfsinslist = scf.Cfsinslist
Deadletterconfig = scf.Deadletterconfig
Eipconfig = scf.Eipconfig
Eipconfig1 = scf.Eipconfig1
Environment = scf.Environment
Filters = scf.Filters
Functions = scf.Functions
GetFunctionsReq = scf.GetFunctionsReq
GetFunctionsResp = scf.GetFunctionsResp
GetFunctionsResponse = scf.GetFunctionsResponse
Layers = scf.Layers
ListFunctionsReq = scf.ListFunctionsReq
ListFunctionsResp = scf.ListFunctionsResp
ListFunctionsResponse = scf.ListFunctionsResponse
Protocolparams = scf.Protocolparams
Publicnetconfig = scf.Publicnetconfig
Statusreasons = scf.Statusreasons
Tags = scf.Tags
Triggers = scf.Triggers
Variables = scf.Variables
Vpcconfig = scf.Vpcconfig
Wsparams = scf.Wsparams
Accessinfo = scf.Accessinfo
Cfsconfig = scf.Cfsconfig
Cfsinslist = scf.Cfsinslist
Deadletterconfig = scf.Deadletterconfig
DeleteFunctionsReq = scf.DeleteFunctionsReq
DeleteFunctionsResp = scf.DeleteFunctionsResp
DeleteFunctionsResponse = scf.DeleteFunctionsResponse
Eipconfig = scf.Eipconfig
Eipconfig1 = scf.Eipconfig1
Environment = scf.Environment
Filters = scf.Filters
Functions = scf.Functions
GetFunctionsReq = scf.GetFunctionsReq
GetFunctionsResp = scf.GetFunctionsResp
GetFunctionsResponse = scf.GetFunctionsResponse
Layers = scf.Layers
ListFunctionsReq = scf.ListFunctionsReq
ListFunctionsResp = scf.ListFunctionsResp
ListFunctionsResponse = scf.ListFunctionsResponse
Protocolparams = scf.Protocolparams
Publicnetconfig = scf.Publicnetconfig
Statusreasons = scf.Statusreasons
Tags = scf.Tags
Triggers = scf.Triggers
Variables = scf.Variables
Vpcconfig = scf.Vpcconfig
Wsparams = scf.Wsparams
Scf interface {
// ListFunctions 查询腾讯云云函数列表
ListFunctions(ctx context.Context, in *ListFunctionsReq, opts ...grpc.CallOption) (*ListFunctionsResp, error)
// GetFunctions 查询腾讯云云函数详情
GetFunctions(ctx context.Context, in *GetFunctionsReq, opts ...grpc.CallOption) (*GetFunctionsResp, error)
// DeleteFunctions 删除腾讯云函数
DeleteFunctions(ctx context.Context, in *DeleteFunctionsReq, opts ...grpc.CallOption) (*DeleteFunctionsResp, error)
}
defaultScf struct {
@ -67,3 +72,9 @@ func (m *defaultScf) GetFunctions(ctx context.Context, in *GetFunctionsReq, opts
client := scf.NewScfClient(m.cli.Conn())
return client.GetFunctions(ctx, in, opts...)
}
// DeleteFunctions 删除腾讯云函数
func (m *defaultScf) DeleteFunctions(ctx context.Context, in *DeleteFunctionsReq, opts ...grpc.CallOption) (*DeleteFunctionsResp, error) {
client := scf.NewScfClient(m.cli.Conn())
return client.DeleteFunctions(ctx, in, opts...)
}