add runtimes endpoint to functions

This commit is contained in:
Asim Aslam
2022-03-01 15:41:57 +00:00
parent e528fa33b2
commit 5d0a352225
4 changed files with 212 additions and 60 deletions

View File

@@ -751,7 +751,7 @@ func (e *GoogleFunction) Describe(ctx context.Context, req *function.DescribeReq
fn.Status = status
// set the url
if len(fn.Url) == 0 && status == "Active" {
if len(fn.Url) == 0 && status == "Deployed" {
v := m["httpsTrigger"].(map[string]interface{})
fn.Url = v["url"].(string)
}
@@ -802,6 +802,11 @@ func (e *GoogleFunction) Regions(ctx context.Context, req *function.RegionsReque
return nil
}
func (e *GoogleFunction) Runtimes(ctx context.Context, req *function.RuntimesRequest, rsp *function.RuntimesResponse) error {
rsp.Runtimes = GoogleRuntimes
return nil
}
func (e *GoogleFunction) DeleteData(ctx context.Context, request *adminpb.DeleteDataRequest, response *adminpb.DeleteDataResponse) error {
method := "admin.DeleteData"
_, err := pauth.VerifyMicroAdmin(ctx, method)

View File

@@ -1173,6 +1173,92 @@ func (x *ReserveResponse) GetReservation() *Reservation {
return nil
}
// Return a list of supported runtimes
type RuntimesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *RuntimesRequest) Reset() {
*x = RuntimesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_function_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RuntimesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RuntimesRequest) ProtoMessage() {}
func (x *RuntimesRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_function_proto_msgTypes[20]
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 RuntimesRequest.ProtoReflect.Descriptor instead.
func (*RuntimesRequest) Descriptor() ([]byte, []int) {
return file_proto_function_proto_rawDescGZIP(), []int{20}
}
type RuntimesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Runtimes []string `protobuf:"bytes,1,rep,name=runtimes,proto3" json:"runtimes,omitempty"`
}
func (x *RuntimesResponse) Reset() {
*x = RuntimesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_function_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RuntimesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RuntimesResponse) ProtoMessage() {}
func (x *RuntimesResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_function_proto_msgTypes[21]
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 RuntimesResponse.ProtoReflect.Descriptor instead.
func (*RuntimesResponse) Descriptor() ([]byte, []int) {
return file_proto_function_proto_rawDescGZIP(), []int{21}
}
func (x *RuntimesResponse) GetRuntimes() []string {
if x != nil {
return x.Runtimes
}
return nil
}
var File_proto_function_proto protoreflect.FileDescriptor
var file_proto_function_proto_rawDesc = []byte{
@@ -1280,45 +1366,53 @@ var file_proto_function_proto_rawDesc = []byte{
0x73, 0x65, 0x12, 0x37, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b,
0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xbe, 0x04, 0x0a, 0x08,
0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c,
0x12, 0x15, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x61, 0x6c, 0x6c,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x12, 0x3d, 0x0a, 0x06, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x12, 0x17, 0x2e, 0x66, 0x75,
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
0x12, 0x37, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x16, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x06, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x12, 0x17, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x66,
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x08, 0x44, 0x65, 0x73, 0x63,
0x72, 0x69, 0x62, 0x65, 0x12, 0x19, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x1a, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72,
0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a,
0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x17, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x18, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x05,
0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x16, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x07, 0x52, 0x65, 0x67, 0x69,
0x6f, 0x6e, 0x73, 0x12, 0x18, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e,
0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x07, 0x52, 0x65,
0x73, 0x65, 0x72, 0x76, 0x65, 0x12, 0x18, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x19, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72,
0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x12, 0x5a, 0x10,
0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x11, 0x0a, 0x0f, 0x52,
0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x2e,
0x0a, 0x10, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x01,
0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x32, 0x83,
0x05, 0x0a, 0x08, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x04, 0x43,
0x61, 0x6c, 0x6c, 0x12, 0x15, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43,
0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x66, 0x75, 0x6e,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x06, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x12, 0x17,
0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x66, 0x75,
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x06,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x17, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x18, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x08, 0x44,
0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x19, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x65,
0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
0x12, 0x3d, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x17, 0x2e, 0x66, 0x75, 0x6e,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x3a, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x16, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x17, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x78,
0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x07, 0x52,
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x18, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x19, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69,
0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a,
0x07, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x12, 0x18, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x19, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65,
0x73, 0x65, 0x72, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x43, 0x0a, 0x08, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x12, 0x19, 0x2e, 0x66, 0x75,
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x2e, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x42, 0x12, 0x5a, 0x10, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b,
0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -1333,7 +1427,7 @@ func file_proto_function_proto_rawDescGZIP() []byte {
return file_proto_function_proto_rawDescData
}
var file_proto_function_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_proto_function_proto_msgTypes = make([]protoimpl.MessageInfo, 24)
var file_proto_function_proto_goTypes = []interface{}{
(*CallRequest)(nil), // 0: function.CallRequest
(*CallResponse)(nil), // 1: function.CallResponse
@@ -1355,16 +1449,18 @@ var file_proto_function_proto_goTypes = []interface{}{
(*Reservation)(nil), // 17: function.Reservation
(*ReserveRequest)(nil), // 18: function.ReserveRequest
(*ReserveResponse)(nil), // 19: function.ReserveResponse
nil, // 20: function.DeployRequest.EnvVarsEntry
nil, // 21: function.Func.EnvVarsEntry
(*structpb.Struct)(nil), // 22: google.protobuf.Struct
(*RuntimesRequest)(nil), // 20: function.RuntimesRequest
(*RuntimesResponse)(nil), // 21: function.RuntimesResponse
nil, // 22: function.DeployRequest.EnvVarsEntry
nil, // 23: function.Func.EnvVarsEntry
(*structpb.Struct)(nil), // 24: google.protobuf.Struct
}
var file_proto_function_proto_depIdxs = []int32{
22, // 0: function.CallRequest.request:type_name -> google.protobuf.Struct
22, // 1: function.CallResponse.response:type_name -> google.protobuf.Struct
20, // 2: function.DeployRequest.env_vars:type_name -> function.DeployRequest.EnvVarsEntry
24, // 0: function.CallRequest.request:type_name -> google.protobuf.Struct
24, // 1: function.CallResponse.response:type_name -> google.protobuf.Struct
22, // 2: function.DeployRequest.env_vars:type_name -> function.DeployRequest.EnvVarsEntry
5, // 3: function.DeployResponse.function:type_name -> function.Func
21, // 4: function.Func.env_vars:type_name -> function.Func.EnvVarsEntry
23, // 4: function.Func.env_vars:type_name -> function.Func.EnvVarsEntry
5, // 5: function.ListResponse.functions:type_name -> function.Func
5, // 6: function.DescribeResponse.function:type_name -> function.Func
17, // 7: function.ReserveResponse.reservation:type_name -> function.Reservation
@@ -1377,17 +1473,19 @@ var file_proto_function_proto_depIdxs = []int32{
13, // 14: function.Function.Proxy:input_type -> function.ProxyRequest
15, // 15: function.Function.Regions:input_type -> function.RegionsRequest
18, // 16: function.Function.Reserve:input_type -> function.ReserveRequest
1, // 17: function.Function.Call:output_type -> function.CallResponse
3, // 18: function.Function.Deploy:output_type -> function.DeployResponse
6, // 19: function.Function.List:output_type -> function.ListResponse
8, // 20: function.Function.Delete:output_type -> function.DeleteResponse
10, // 21: function.Function.Describe:output_type -> function.DescribeResponse
12, // 22: function.Function.Update:output_type -> function.UpdateResponse
14, // 23: function.Function.Proxy:output_type -> function.ProxyResponse
16, // 24: function.Function.Regions:output_type -> function.RegionsResponse
19, // 25: function.Function.Reserve:output_type -> function.ReserveResponse
17, // [17:26] is the sub-list for method output_type
8, // [8:17] is the sub-list for method input_type
20, // 17: function.Function.Runtimes:input_type -> function.RuntimesRequest
1, // 18: function.Function.Call:output_type -> function.CallResponse
3, // 19: function.Function.Deploy:output_type -> function.DeployResponse
6, // 20: function.Function.List:output_type -> function.ListResponse
8, // 21: function.Function.Delete:output_type -> function.DeleteResponse
10, // 22: function.Function.Describe:output_type -> function.DescribeResponse
12, // 23: function.Function.Update:output_type -> function.UpdateResponse
14, // 24: function.Function.Proxy:output_type -> function.ProxyResponse
16, // 25: function.Function.Regions:output_type -> function.RegionsResponse
19, // 26: function.Function.Reserve:output_type -> function.ReserveResponse
21, // 27: function.Function.Runtimes:output_type -> function.RuntimesResponse
18, // [18:28] is the sub-list for method output_type
8, // [8:18] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
@@ -1639,6 +1737,30 @@ func file_proto_function_proto_init() {
return nil
}
}
file_proto_function_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RuntimesRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_function_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RuntimesResponse); 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{
@@ -1646,7 +1768,7 @@ func file_proto_function_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proto_function_proto_rawDesc,
NumEnums: 0,
NumMessages: 22,
NumMessages: 24,
NumExtensions: 0,
NumServices: 1,
},

View File

@@ -52,6 +52,7 @@ type FunctionService interface {
Proxy(ctx context.Context, in *ProxyRequest, opts ...client.CallOption) (*ProxyResponse, error)
Regions(ctx context.Context, in *RegionsRequest, opts ...client.CallOption) (*RegionsResponse, error)
Reserve(ctx context.Context, in *ReserveRequest, opts ...client.CallOption) (*ReserveResponse, error)
Runtimes(ctx context.Context, in *RuntimesRequest, opts ...client.CallOption) (*RuntimesResponse, error)
}
type functionService struct {
@@ -156,6 +157,16 @@ func (c *functionService) Reserve(ctx context.Context, in *ReserveRequest, opts
return out, nil
}
func (c *functionService) Runtimes(ctx context.Context, in *RuntimesRequest, opts ...client.CallOption) (*RuntimesResponse, error) {
req := c.c.NewRequest(c.name, "Function.Runtimes", in)
out := new(RuntimesResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Function service
type FunctionHandler interface {
@@ -168,6 +179,7 @@ type FunctionHandler interface {
Proxy(context.Context, *ProxyRequest, *ProxyResponse) error
Regions(context.Context, *RegionsRequest, *RegionsResponse) error
Reserve(context.Context, *ReserveRequest, *ReserveResponse) error
Runtimes(context.Context, *RuntimesRequest, *RuntimesResponse) error
}
func RegisterFunctionHandler(s server.Server, hdlr FunctionHandler, opts ...server.HandlerOption) error {
@@ -181,6 +193,7 @@ func RegisterFunctionHandler(s server.Server, hdlr FunctionHandler, opts ...serv
Proxy(ctx context.Context, in *ProxyRequest, out *ProxyResponse) error
Regions(ctx context.Context, in *RegionsRequest, out *RegionsResponse) error
Reserve(ctx context.Context, in *ReserveRequest, out *ReserveResponse) error
Runtimes(ctx context.Context, in *RuntimesRequest, out *RuntimesResponse) error
}
type Function struct {
function
@@ -228,3 +241,7 @@ func (h *functionHandler) Regions(ctx context.Context, in *RegionsRequest, out *
func (h *functionHandler) Reserve(ctx context.Context, in *ReserveRequest, out *ReserveResponse) error {
return h.FunctionHandler.Reserve(ctx, in, out)
}
func (h *functionHandler) Runtimes(ctx context.Context, in *RuntimesRequest, out *RuntimesResponse) error {
return h.FunctionHandler.Runtimes(ctx, in, out)
}

View File

@@ -15,6 +15,7 @@ service Function {
rpc Proxy(ProxyRequest) returns (ProxyResponse) {}
rpc Regions(RegionsRequest) returns (RegionsResponse) {}
rpc Reserve(ReserveRequest) returns (ReserveResponse) {}
rpc Runtimes(RuntimesRequest) returns (RuntimesResponse) {}
}
// Call a function by name
@@ -174,3 +175,10 @@ message ReserveResponse {
Reservation reservation = 1;
}
// Return a list of supported runtimes
message RuntimesRequest {
}
message RuntimesResponse {
repeated string runtimes = 1;
}