add ListWorkflowTemplateVersions

This commit is contained in:
rushtehrani
2019-12-12 17:54:45 -08:00
parent 87c9d20f4d
commit b0f150a49b
9 changed files with 409 additions and 41 deletions

View File

@@ -191,32 +191,35 @@ func init() {
func init() { proto.RegisterFile("workflow.proto", fileDescriptor_892c7f566756b0be) }
var fileDescriptor_892c7f566756b0be = []byte{
// 388 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xc1, 0x4e, 0xf2, 0x40,
0x10, 0xc7, 0x53, 0xca, 0xf7, 0x85, 0x0e, 0x11, 0xc9, 0x2a, 0xda, 0x34, 0x24, 0x92, 0xf5, 0x82,
0x89, 0x69, 0x43, 0x95, 0x0b, 0x27, 0x8d, 0x89, 0x5e, 0x4d, 0x35, 0xf1, 0xa8, 0x0b, 0xac, 0xa4,
0xb1, 0x74, 0x6b, 0xbb, 0x85, 0x03, 0xe1, 0xe2, 0xcd, 0xb3, 0x47, 0x8f, 0x3e, 0x80, 0x0f, 0xe3,
0x2b, 0xf8, 0x20, 0x86, 0xa5, 0xbb, 0xd2, 0xd0, 0x84, 0x78, 0x5b, 0x66, 0x86, 0xdf, 0xfc, 0xf6,
0xdf, 0x85, 0xda, 0x94, 0xc5, 0x4f, 0x8f, 0x01, 0x9b, 0xda, 0x51, 0xcc, 0x38, 0x43, 0x3a, 0x89,
0x7c, 0xab, 0x39, 0x62, 0x6c, 0x14, 0x50, 0x87, 0x44, 0xbe, 0x43, 0xc2, 0x90, 0x71, 0xc2, 0x7d,
0x16, 0x26, 0xcb, 0x11, 0x6b, 0x5f, 0xfe, 0xe5, 0x9e, 0xd3, 0x71, 0x14, 0x10, 0x4e, 0x97, 0x0d,
0xfc, 0x00, 0x8d, 0x8b, 0x98, 0x12, 0x4e, 0xef, 0xb2, 0x01, 0x8f, 0x3e, 0xa7, 0x34, 0xe1, 0xa8,
0x09, 0x46, 0x48, 0xc6, 0x34, 0x89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0xe3, 0xcd, 0x32,
0xea, 0x5d, 0x25, 0xbd, 0xb5, 0x70, 0xd1, 0xab, 0x06, 0x3b, 0x57, 0x94, 0xaf, 0xa9, 0x1d, 0x88,
0xb5, 0x05, 0x9d, 0x0d, 0x5e, 0x3d, 0xe1, 0x75, 0x8a, 0xdc, 0xbf, 0x78, 0x39, 0xb3, 0xd4, 0x1f,
0xce, 0xfb, 0xff, 0xc5, 0xbb, 0x3f, 0xf9, 0x09, 0x00, 0x00, 0xff, 0xff, 0x6a, 0xc9, 0x46, 0x21,
0x45, 0x03, 0x00, 0x00,
// 436 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x31, 0x6f, 0x13, 0x31,
0x18, 0x86, 0xe5, 0x26, 0xa0, 0xe6, 0xab, 0x08, 0xd5, 0x07, 0x85, 0x28, 0x8a, 0x44, 0x64, 0x96,
0x54, 0x42, 0xb1, 0x1a, 0xe8, 0x12, 0x84, 0x04, 0xaa, 0x04, 0x0b, 0x03, 0x3a, 0x10, 0x8c, 0xe0,
0xb6, 0x1f, 0x95, 0x45, 0x72, 0x36, 0xb6, 0x93, 0x0e, 0x55, 0x17, 0x36, 0x66, 0x46, 0x46, 0xfe,
0x04, 0xff, 0x83, 0xbf, 0xc0, 0xc4, 0xaf, 0x40, 0xe7, 0x9c, 0x4d, 0x4f, 0x77, 0xa2, 0xcd, 0xe6,
0xf3, 0xf7, 0xde, 0xfb, 0x3e, 0x7e, 0xef, 0x0c, 0xdd, 0x53, 0x6d, 0x3f, 0x7d, 0x9c, 0xe9, 0xd3,
0xb1, 0xb1, 0xda, 0x6b, 0x6c, 0x49, 0xa3, 0xfa, 0x83, 0x13, 0xad, 0x4f, 0x66, 0x24, 0xa4, 0x51,
0x42, 0xe6, 0xb9, 0xf6, 0xd2, 0x2b, 0x9d, 0xbb, 0x95, 0xa4, 0x7f, 0x37, 0xbe, 0xf2, 0xde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c, 0x13, 0x67, 0xa9, 0xfa, 0x73, 0x11, 0xd9, 0xdd, 0x34, 0x95, 0x8c,
0xdf, 0x19, 0xdc, 0xa9, 0xfa, 0xc7, 0x93, 0x21, 0x6f, 0x08, 0x4f, 0x45, 0x94, 0x10, 0xcd, 0x35,
0xf1, 0xe7, 0x01, 0xe6, 0x29, 0x7f, 0x70, 0x39, 0x4c, 0xfa, 0xaf, 0xdc, 0xb4, 0x56, 0x2e, 0x7e,
0x65, 0x70, 0xeb, 0x05, 0xf9, 0x1a, 0xda, 0xbd, 0x10, 0xdb, 0x30, 0xb9, 0x84, 0x6b, 0x1a, 0xb8,
0x1e, 0xe1, 0x64, 0x1d, 0x2e, 0x71, 0xb6, 0x50, 0xc7, 0xe7, 0xf8, 0x93, 0xc1, 0xe0, 0xa5, 0x72,
0xb5, 0xc8, 0xb7, 0x64, 0x5d, 0x71, 0x61, 0x70, 0x14, 0x32, 0xff, 0x27, 0x89, 0x74, 0xbb, 0x57,
0x50, 0x3a, 0xa3, 0x73, 0x47, 0xfc, 0x20, 0x10, 0x3f, 0xc1, 0xc7, 0xeb, 0x13, 0x8b, 0x65, 0x69,
0x76, 0x78, 0x3d, 0x5c, 0xd9, 0x87, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x98, 0xff, 0x3b, 0x58,
0x00, 0x04, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -235,6 +238,7 @@ type WorkflowServiceClient interface {
CreateWorkflow(ctx context.Context, in *CreateWorkflowRequest, opts ...grpc.CallOption) (*Workflow, error)
CreateWorkflowTemplate(ctx context.Context, in *CreateWorkflowTemplateRequest, opts ...grpc.CallOption) (*WorkflowTemplate, error)
GetWorkflowTemplate(ctx context.Context, in *GetWorkflowTemplateRequest, opts ...grpc.CallOption) (*WorkflowTemplate, error)
ListWorkflowTemplateVersions(ctx context.Context, in *ListWorkflowTemplateVersionsRequest, opts ...grpc.CallOption) (*ListWorkflowTemplateVersionsResponse, error)
}
type workflowServiceClient struct {
@@ -272,12 +276,22 @@ func (c *workflowServiceClient) GetWorkflowTemplate(ctx context.Context, in *Get
return out, nil
}
func (c *workflowServiceClient) ListWorkflowTemplateVersions(ctx context.Context, in *ListWorkflowTemplateVersionsRequest, opts ...grpc.CallOption) (*ListWorkflowTemplateVersionsResponse, error) {
out := new(ListWorkflowTemplateVersionsResponse)
err := c.cc.Invoke(ctx, "/api.WorkflowService/ListWorkflowTemplateVersions", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// WorkflowServiceServer is the server API for WorkflowService service.
type WorkflowServiceServer interface {
// Creates a Workflow
CreateWorkflow(context.Context, *CreateWorkflowRequest) (*Workflow, error)
CreateWorkflowTemplate(context.Context, *CreateWorkflowTemplateRequest) (*WorkflowTemplate, error)
GetWorkflowTemplate(context.Context, *GetWorkflowTemplateRequest) (*WorkflowTemplate, error)
ListWorkflowTemplateVersions(context.Context, *ListWorkflowTemplateVersionsRequest) (*ListWorkflowTemplateVersionsResponse, error)
}
// UnimplementedWorkflowServiceServer can be embedded to have forward compatible implementations.
@@ -293,6 +307,9 @@ func (*UnimplementedWorkflowServiceServer) CreateWorkflowTemplate(ctx context.Co
func (*UnimplementedWorkflowServiceServer) GetWorkflowTemplate(ctx context.Context, req *GetWorkflowTemplateRequest) (*WorkflowTemplate, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetWorkflowTemplate not implemented")
}
func (*UnimplementedWorkflowServiceServer) ListWorkflowTemplateVersions(ctx context.Context, req *ListWorkflowTemplateVersionsRequest) (*ListWorkflowTemplateVersionsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListWorkflowTemplateVersions not implemented")
}
func RegisterWorkflowServiceServer(s *grpc.Server, srv WorkflowServiceServer) {
s.RegisterService(&_WorkflowService_serviceDesc, srv)
@@ -352,6 +369,24 @@ func _WorkflowService_GetWorkflowTemplate_Handler(srv interface{}, ctx context.C
return interceptor(ctx, in, info, handler)
}
func _WorkflowService_ListWorkflowTemplateVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListWorkflowTemplateVersionsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WorkflowServiceServer).ListWorkflowTemplateVersions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.WorkflowService/ListWorkflowTemplateVersions",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WorkflowServiceServer).ListWorkflowTemplateVersions(ctx, req.(*ListWorkflowTemplateVersionsRequest))
}
return interceptor(ctx, in, info, handler)
}
var _WorkflowService_serviceDesc = grpc.ServiceDesc{
ServiceName: "api.WorkflowService",
HandlerType: (*WorkflowServiceServer)(nil),
@@ -368,6 +403,10 @@ var _WorkflowService_serviceDesc = grpc.ServiceDesc{
MethodName: "GetWorkflowTemplate",
Handler: _WorkflowService_GetWorkflowTemplate_Handler,
},
{
MethodName: "ListWorkflowTemplateVersions",
Handler: _WorkflowService_ListWorkflowTemplateVersions_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "workflow.proto",

View File

@@ -247,6 +247,82 @@ func local_request_WorkflowService_GetWorkflowTemplate_0(ctx context.Context, ma
}
func request_WorkflowService_ListWorkflowTemplateVersions_0(ctx context.Context, marshaler runtime.Marshaler, client WorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListWorkflowTemplateVersionsRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.ListWorkflowTemplateVersions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WorkflowService_ListWorkflowTemplateVersions_0(ctx context.Context, marshaler runtime.Marshaler, server WorkflowServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListWorkflowTemplateVersionsRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.ListWorkflowTemplateVersions(ctx, &protoReq)
return msg, metadata, err
}
// RegisterWorkflowServiceHandlerServer registers the http handlers for service WorkflowService to "mux".
// UnaryRPC :call WorkflowServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -312,6 +388,26 @@ func RegisterWorkflowServiceHandlerServer(ctx context.Context, mux *runtime.Serv
})
mux.Handle("GET", pattern_WorkflowService_ListWorkflowTemplateVersions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_WorkflowService_ListWorkflowTemplateVersions_0(rctx, inboundMarshaler, server, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkflowService_ListWorkflowTemplateVersions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -413,6 +509,26 @@ func RegisterWorkflowServiceHandlerClient(ctx context.Context, mux *runtime.Serv
})
mux.Handle("GET", pattern_WorkflowService_ListWorkflowTemplateVersions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WorkflowService_ListWorkflowTemplateVersions_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkflowService_ListWorkflowTemplateVersions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -422,6 +538,8 @@ var (
pattern_WorkflowService_CreateWorkflowTemplate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "workflow_templates"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_GetWorkflowTemplate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workflow_templates", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_ListWorkflowTemplateVersions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_templates", "uid", "versions"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (
@@ -430,4 +548,6 @@ var (
forward_WorkflowService_CreateWorkflowTemplate_0 = runtime.ForwardResponseMessage
forward_WorkflowService_GetWorkflowTemplate_0 = runtime.ForwardResponseMessage
forward_WorkflowService_ListWorkflowTemplateVersions_0 = runtime.ForwardResponseMessage
)

View File

@@ -26,6 +26,12 @@ service WorkflowService {
get: "/apis/v1beta1/{namespace}/workflow_templates/{uid}"
};
}
rpc ListWorkflowTemplateVersions (ListWorkflowTemplateVersionsRequest) returns (ListWorkflowTemplateVersionsResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_templates/{uid}/versions"
};
}
}
message CreateWorkflowRequest {

View File

@@ -73,6 +73,36 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_templates/{uid}/versions": {
"get": {
"operationId": "ListWorkflowTemplateVersions",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/apiListWorkflowTemplateVersionsResponse"
}
}
},
"parameters": [
{
"name": "namespace",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "uid",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"WorkflowService"
]
}
},
"/apis/v1beta1/{namespace}/workflows": {
"post": {
"summary": "Creates a Workflow",
@@ -108,6 +138,21 @@
}
},
"definitions": {
"apiListWorkflowTemplateVersionsResponse": {
"type": "object",
"properties": {
"workflowTemplates": {
"type": "array",
"items": {
"$ref": "#/definitions/apiWorkflowTemplate"
}
},
"count": {
"type": "integer",
"format": "int32"
}
}
},
"apiParameter": {
"type": "object",
"properties": {

View File

@@ -114,6 +114,100 @@ func (m *GetWorkflowTemplateRequest) GetUid() string {
return ""
}
type ListWorkflowTemplateVersionsRequest struct {
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListWorkflowTemplateVersionsRequest) Reset() { *m = ListWorkflowTemplateVersionsRequest{} }
func (m *ListWorkflowTemplateVersionsRequest) String() string { return proto.CompactTextString(m) }
func (*ListWorkflowTemplateVersionsRequest) ProtoMessage() {}
func (*ListWorkflowTemplateVersionsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_b9a07547748a96e8, []int{2}
}
func (m *ListWorkflowTemplateVersionsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListWorkflowTemplateVersionsRequest.Unmarshal(m, b)
}
func (m *ListWorkflowTemplateVersionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListWorkflowTemplateVersionsRequest.Marshal(b, m, deterministic)
}
func (m *ListWorkflowTemplateVersionsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListWorkflowTemplateVersionsRequest.Merge(m, src)
}
func (m *ListWorkflowTemplateVersionsRequest) XXX_Size() int {
return xxx_messageInfo_ListWorkflowTemplateVersionsRequest.Size(m)
}
func (m *ListWorkflowTemplateVersionsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ListWorkflowTemplateVersionsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ListWorkflowTemplateVersionsRequest proto.InternalMessageInfo
func (m *ListWorkflowTemplateVersionsRequest) GetNamespace() string {
if m != nil {
return m.Namespace
}
return ""
}
func (m *ListWorkflowTemplateVersionsRequest) GetUid() string {
if m != nil {
return m.Uid
}
return ""
}
type ListWorkflowTemplateVersionsResponse struct {
WorkflowTemplates []*WorkflowTemplate `protobuf:"bytes,1,rep,name=workflowTemplates,proto3" json:"workflowTemplates,omitempty"`
Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListWorkflowTemplateVersionsResponse) Reset() { *m = ListWorkflowTemplateVersionsResponse{} }
func (m *ListWorkflowTemplateVersionsResponse) String() string { return proto.CompactTextString(m) }
func (*ListWorkflowTemplateVersionsResponse) ProtoMessage() {}
func (*ListWorkflowTemplateVersionsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_b9a07547748a96e8, []int{3}
}
func (m *ListWorkflowTemplateVersionsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListWorkflowTemplateVersionsResponse.Unmarshal(m, b)
}
func (m *ListWorkflowTemplateVersionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListWorkflowTemplateVersionsResponse.Marshal(b, m, deterministic)
}
func (m *ListWorkflowTemplateVersionsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListWorkflowTemplateVersionsResponse.Merge(m, src)
}
func (m *ListWorkflowTemplateVersionsResponse) XXX_Size() int {
return xxx_messageInfo_ListWorkflowTemplateVersionsResponse.Size(m)
}
func (m *ListWorkflowTemplateVersionsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListWorkflowTemplateVersionsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListWorkflowTemplateVersionsResponse proto.InternalMessageInfo
func (m *ListWorkflowTemplateVersionsResponse) GetWorkflowTemplates() []*WorkflowTemplate {
if m != nil {
return m.WorkflowTemplates
}
return nil
}
func (m *ListWorkflowTemplateVersionsResponse) GetCount() int32 {
if m != nil {
return m.Count
}
return 0
}
type WorkflowTemplate struct {
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
@@ -128,7 +222,7 @@ func (m *WorkflowTemplate) Reset() { *m = WorkflowTemplate{} }
func (m *WorkflowTemplate) String() string { return proto.CompactTextString(m) }
func (*WorkflowTemplate) ProtoMessage() {}
func (*WorkflowTemplate) Descriptor() ([]byte, []int) {
return fileDescriptor_b9a07547748a96e8, []int{2}
return fileDescriptor_b9a07547748a96e8, []int{4}
}
func (m *WorkflowTemplate) XXX_Unmarshal(b []byte) error {
@@ -180,24 +274,30 @@ func (m *WorkflowTemplate) GetManifest() string {
func init() {
proto.RegisterType((*CreateWorkflowTemplateRequest)(nil), "api.CreateWorkflowTemplateRequest")
proto.RegisterType((*GetWorkflowTemplateRequest)(nil), "api.GetWorkflowTemplateRequest")
proto.RegisterType((*ListWorkflowTemplateVersionsRequest)(nil), "api.ListWorkflowTemplateVersionsRequest")
proto.RegisterType((*ListWorkflowTemplateVersionsResponse)(nil), "api.ListWorkflowTemplateVersionsResponse")
proto.RegisterType((*WorkflowTemplate)(nil), "api.WorkflowTemplate")
}
func init() { proto.RegisterFile("workflow_template.proto", fileDescriptor_b9a07547748a96e8) }
var fileDescriptor_b9a07547748a96e8 = []byte{
// 207 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0xcf, 0x2f, 0xca,
0x4e, 0xcb, 0xc9, 0x2f, 0x8f, 0x2f, 0x49, 0xcd, 0x2d, 0xc8, 0x49, 0x2c, 0x49, 0xd5, 0x2b, 0x28,
0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4e, 0x2c, 0xc8, 0x54, 0x6a, 0x60, 0xe4, 0x92, 0x75, 0x2e, 0x4a,
0x4d, 0x2c, 0x49, 0x0d, 0x87, 0x2a, 0x0b, 0x81, 0xaa, 0x0a, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e,
0x11, 0x92, 0xe1, 0xe2, 0xcc, 0x4b, 0xcc, 0x4d, 0x2d, 0x2e, 0x48, 0x4c, 0x4e, 0x95, 0x60, 0x54,
0x60, 0xd4, 0xe0, 0x0c, 0x42, 0x08, 0x08, 0x39, 0x72, 0x09, 0x94, 0xa3, 0x69, 0x94, 0x60, 0x52,
0x60, 0xd4, 0xe0, 0x36, 0x12, 0xd5, 0x4b, 0x2c, 0xc8, 0xd4, 0xc3, 0x30, 0x15, 0x43, 0xb9, 0x92,
0x0f, 0x97, 0x94, 0x7b, 0x6a, 0x09, 0x79, 0xd6, 0x0b, 0x70, 0x31, 0x97, 0x66, 0xa6, 0x80, 0x6d,
0xe4, 0x0c, 0x02, 0x31, 0x95, 0xf2, 0xb8, 0x04, 0xd0, 0x8d, 0x82, 0xa9, 0x62, 0x84, 0xab, 0x12,
0x12, 0xe2, 0x62, 0x01, 0x19, 0x02, 0xd5, 0x08, 0x66, 0x0b, 0x49, 0x70, 0xb1, 0x97, 0xa5, 0x16,
0x15, 0x67, 0xe6, 0xe7, 0x49, 0x30, 0x83, 0x85, 0x61, 0x5c, 0x21, 0x29, 0x2e, 0x8e, 0xdc, 0xc4,
0xbc, 0xcc, 0xb4, 0xd4, 0xe2, 0x12, 0x09, 0x16, 0xb0, 0x14, 0x9c, 0x9f, 0xc4, 0x06, 0x0e, 0x4c,
0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x71, 0x69, 0x39, 0x67, 0x01, 0x00, 0x00,
// 263 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x3f, 0x4f, 0xc3, 0x30,
0x10, 0xc5, 0x65, 0xd2, 0x02, 0x39, 0x96, 0x70, 0x02, 0x61, 0x55, 0x20, 0x45, 0x81, 0xa1, 0x53,
0x06, 0xf8, 0x04, 0xa8, 0x03, 0x4b, 0xa7, 0x88, 0x3f, 0x23, 0x32, 0xe5, 0x2a, 0x59, 0x34, 0xb6,
0xc9, 0x39, 0x64, 0x85, 0x6f, 0x8e, 0xea, 0xa6, 0x45, 0x4a, 0x44, 0x87, 0x6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0xed, 0x30, 0xbc, 0x93, 0xbb, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe8,
0x92, 0xc7, 0xce, 0x42, 0x02, 0x00, 0x00,
}

View File

@@ -12,6 +12,16 @@ message GetWorkflowTemplateRequest {
string uid = 2;
}
message ListWorkflowTemplateVersionsRequest {
string namespace = 1;
string uid = 2;
}
message ListWorkflowTemplateVersionsResponse {
repeated WorkflowTemplate workflowTemplates = 1;
int32 count = 2;
}
message WorkflowTemplate {
string uid = 1;
string name = 2;

View File

@@ -46,3 +46,12 @@ func (r *ResourceManager) GetWorkflowTemplate(namespace, uid string) (workflowTe
return
}
func (r *ResourceManager) ListWorkflowTemplateVersions(namespace, uid string) (workflowTemplateVersions []*model.WorkflowTemplate, err error) {
workflowTemplateVersions, err = r.workflowRepository.ListWorkflowTemplateVersions(uid)
if err != nil {
return nil, util.NewUserError(codes.NotFound, "Workflow template not found.")
}
return
}

View File

@@ -74,3 +74,20 @@ func (r *WorkflowRepository) GetWorkflowTemplate(uid string) (workflowTemplate *
return
}
func (r *WorkflowRepository) ListWorkflowTemplateVersions(uid string) (workflowTemplateVersions []*model.WorkflowTemplate, err error) {
workflowTemplateVersions = []*model.WorkflowTemplate{}
query, args, err := r.sb.Select("wt.uid", "wtv.version", "wtv.manifest").
From("workflow_template_versions wtv").
Join("workflow_templates wt ON wt.id = wtv.workflow_template_id").
Where(sq.Eq{"wt.uid": uid}).
OrderBy("wtv.version desc").ToSql()
if err != nil {
return
}
err = r.db.Select(&workflowTemplateVersions, query, args...)
return
}

View File

@@ -73,3 +73,25 @@ func (s *WorkflowServer) GetWorkflowTemplate(ctx context.Context, req *api.GetWo
Manifest: workflowTemplate.Manifest,
}, nil
}
func (s *WorkflowServer) ListWorkflowTemplateVersions(ctx context.Context, req *api.ListWorkflowTemplateVersionsRequest) (*api.ListWorkflowTemplateVersionsResponse, error) {
workflowTemplateVersions, err := s.resourceManager.ListWorkflowTemplateVersions(req.Namespace, req.Uid)
if errors.As(err, &userError) {
return nil, userError.GRPCError()
}
workflowTemplates := []*api.WorkflowTemplate{}
for _, wtv := range workflowTemplateVersions {
workflowTemplates = append(workflowTemplates, &api.WorkflowTemplate{
Uid: wtv.UID,
Name: wtv.Name,
Version: wtv.Version.String(),
Manifest: wtv.Manifest,
})
}
return &api.ListWorkflowTemplateVersionsResponse{
Count: int32(len(workflowTemplateVersions)),
WorkflowTemplates: workflowTemplates,
}, nil
}