add ListWorkflowTemplates

This commit is contained in:
rushtehrani
2019-12-19 11:15:53 -08:00
parent bdcd517135
commit 3d5aeccaa1
9 changed files with 397 additions and 83 deletions

View File

@@ -214,8 +214,8 @@ func (m *ListWorkflowsRequest) GetWorkflowTemplateUid() string {
}
type ListWorkflowsResponse struct {
Workflows []*Workflow `protobuf:"bytes,1,rep,name=workflows,proto3" json:"workflows,omitempty"`
Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
Workflows []*Workflow `protobuf:"bytes,2,rep,name=workflows,proto3" json:"workflows,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -246,13 +246,6 @@ func (m *ListWorkflowsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_ListWorkflowsResponse proto.InternalMessageInfo
func (m *ListWorkflowsResponse) GetWorkflows() []*Workflow {
if m != nil {
return m.Workflows
}
return nil
}
func (m *ListWorkflowsResponse) GetCount() int32 {
if m != nil {
return m.Count
@@ -260,6 +253,13 @@ func (m *ListWorkflowsResponse) GetCount() int32 {
return 0
}
func (m *ListWorkflowsResponse) GetWorkflows() []*Workflow {
if m != nil {
return m.Workflows
}
return nil
}
type Workflow 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"`
@@ -391,45 +391,46 @@ func init() {
func init() { proto.RegisterFile("workflow.proto", fileDescriptor_892c7f566756b0be) }
var fileDescriptor_892c7f566756b0be = []byte{
// 596 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x6e, 0xd3, 0x40,
0x10, 0x66, 0x9b, 0xa6, 0x34, 0x53, 0xb5, 0x54, 0xd3, 0xb4, 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f, 0xa2, 0x67, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x90, 0x49, 0xff, 0xc5,
0xd7, 0x06, 0x00, 0x00,
// 624 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x6e, 0xd3, 0x4e,
0x10, 0xfe, 0xb9, 0x69, 0xaa, 0x66, 0xaa, 0xe4, 0x57, 0x4d, 0x93, 0xd6, 0x58, 0x91, 0x08, 0x8b,
0x90, 0x52, 0x5a, 0xc5, 0x6d, 0xa0, 0x97, 0xa2, 0x4a, 0xa0, 0x8a, 0x96, 0x03, 0x07, 0x64, 0xfe,
0x54, 0xea, 0x05, 0xb6, 0xc9, 0xb6, 0x58, 0x24, 0xb6, 0xf1, 0xae, 0xd3, 0x43, 0x94, 0x0b, 0x3c,
0x02, 0xdc, 0x78, 0x11, 0x24, 0x1e, 0xa3, 0xaf, 0xc0, 0x89, 0xa7, 0x40, 0x59, 0x7b, 0xb7, 0xb1,
0x63, 0x20, 0x51, 0x6f, 0xbb, 0x33, 0xe3, 0x6f, 0xbe, 0x6f, 0xe7, 0xdb, 0x35, 0x54, 0x2e, 0xfd,
0xf0, 0xc3, 0x79, 0xcf, 0xbf, 0x6c, 0x05, 0xa1, 0x2f, 0x7c, 0x2c, 0xd0, 0xc0, 0xb5, 0xea, 0x17,
0xbe, 0x7f, 0xd1, 0x63, 0x36, 0x0d, 0x5c, 0x9b, 0x7a, 0x9e, 0x2f, 0xa8, 0x70, 0x7d, 0x8f, 0xc7,
0x25, 0xd6, 0x86, 0xfa, 0xe4, 0xad, 0x60, 0xfd, 0xa0, 0x47, 0x05, 0x8b, 0x13, 0xe4, 0x1d, 0xd4,
0x0e, 0x43, 0x46, 0x05, 0x3b, 0x49, 0x0a, 0x1c, 0xf6, 0x31, 0x62, 0x5c, 0x60, 0x1d, 0x4a, 0x1e,
0xed, 0x33, 0x1e, 0xd0,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x7c, 0x3a, 0xff, 0x57, 0xf6, 0x80, 0x85, 0x7c, 0xfc, 0xb8,
0xdb, 0xc3, 0x64, 0x35, 0xc2, 0xef, 0x06, 0xd4, 0x27, 0x27, 0xaf, 0xe8, 0xbd, 0x49, 0x4a, 0xb1,
0x39, 0x65, 0x8e, 0x6c, 0x89, 0xd2, 0xb9, 0x39, 0x43, 0x65, 0xe2, 0xaa, 0x43, 0x29, 0xfd, 0x00,
0x1f, 0xdd, 0x40, 0x04, 0x7e, 0x35, 0xd2, 0xef, 0xa4, 0xea, 0xc6, 0xf1, 0xce, 0x1f, 0x99, 0x68,
0xb2, 0xe4, 0x6f, 0x25, 0x09, 0xcb, 0x87, 0x92, 0x65, 0x0b, 0xe7, 0x72, 0xce, 0xd9, 0x92, 0xfc,
0x41, 0x3e, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x12, 0x2a, 0x17, 0xe3, 0x6e, 0x07, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -452,6 +453,7 @@ type WorkflowServiceClient interface {
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)
ListWorkflowTemplates(ctx context.Context, in *ListWorkflowTemplatesRequest, opts ...grpc.CallOption) (*ListWorkflowTemplatesResponse, error)
}
type workflowServiceClient struct {
@@ -548,6 +550,15 @@ func (c *workflowServiceClient) ListWorkflowTemplateVersions(ctx context.Context
return out, nil
}
func (c *workflowServiceClient) ListWorkflowTemplates(ctx context.Context, in *ListWorkflowTemplatesRequest, opts ...grpc.CallOption) (*ListWorkflowTemplatesResponse, error) {
out := new(ListWorkflowTemplatesResponse)
err := c.cc.Invoke(ctx, "/api.WorkflowService/ListWorkflowTemplates", 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
@@ -558,6 +569,7 @@ type WorkflowServiceServer interface {
CreateWorkflowTemplate(context.Context, *CreateWorkflowTemplateRequest) (*WorkflowTemplate, error)
GetWorkflowTemplate(context.Context, *GetWorkflowTemplateRequest) (*WorkflowTemplate, error)
ListWorkflowTemplateVersions(context.Context, *ListWorkflowTemplateVersionsRequest) (*ListWorkflowTemplateVersionsResponse, error)
ListWorkflowTemplates(context.Context, *ListWorkflowTemplatesRequest) (*ListWorkflowTemplatesResponse, error)
}
// UnimplementedWorkflowServiceServer can be embedded to have forward compatible implementations.
@@ -585,6 +597,9 @@ func (*UnimplementedWorkflowServiceServer) GetWorkflowTemplate(ctx context.Conte
func (*UnimplementedWorkflowServiceServer) ListWorkflowTemplateVersions(ctx context.Context, req *ListWorkflowTemplateVersionsRequest) (*ListWorkflowTemplateVersionsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListWorkflowTemplateVersions not implemented")
}
func (*UnimplementedWorkflowServiceServer) ListWorkflowTemplates(ctx context.Context, req *ListWorkflowTemplatesRequest) (*ListWorkflowTemplatesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListWorkflowTemplates not implemented")
}
func RegisterWorkflowServiceServer(s *grpc.Server, srv WorkflowServiceServer) {
s.RegisterService(&_WorkflowService_serviceDesc, srv)
@@ -719,6 +734,24 @@ func _WorkflowService_ListWorkflowTemplateVersions_Handler(srv interface{}, ctx
return interceptor(ctx, in, info, handler)
}
func _WorkflowService_ListWorkflowTemplates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListWorkflowTemplatesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WorkflowServiceServer).ListWorkflowTemplates(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.WorkflowService/ListWorkflowTemplates",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WorkflowServiceServer).ListWorkflowTemplates(ctx, req.(*ListWorkflowTemplatesRequest))
}
return interceptor(ctx, in, info, handler)
}
var _WorkflowService_serviceDesc = grpc.ServiceDesc{
ServiceName: "api.WorkflowService",
HandlerType: (*WorkflowServiceServer)(nil),
@@ -747,6 +780,10 @@ var _WorkflowService_serviceDesc = grpc.ServiceDesc{
MethodName: "ListWorkflowTemplateVersions",
Handler: _WorkflowService_ListWorkflowTemplateVersions_Handler,
},
{
MethodName: "ListWorkflowTemplates",
Handler: _WorkflowService_ListWorkflowTemplates_Handler,
},
},
Streams: []grpc.StreamDesc{
{

View File

@@ -581,6 +581,60 @@ func local_request_WorkflowService_ListWorkflowTemplateVersions_0(ctx context.Co
}
func request_WorkflowService_ListWorkflowTemplates_0(ctx context.Context, marshaler runtime.Marshaler, client WorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListWorkflowTemplatesRequest
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)
}
msg, err := client.ListWorkflowTemplates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WorkflowService_ListWorkflowTemplates_0(ctx context.Context, marshaler runtime.Marshaler, server WorkflowServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListWorkflowTemplatesRequest
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)
}
msg, err := server.ListWorkflowTemplates(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.
@@ -726,6 +780,26 @@ func RegisterWorkflowServiceHandlerServer(ctx context.Context, mux *runtime.Serv
})
mux.Handle("GET", pattern_WorkflowService_ListWorkflowTemplates_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_ListWorkflowTemplates_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_ListWorkflowTemplates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -907,6 +981,26 @@ func RegisterWorkflowServiceHandlerClient(ctx context.Context, mux *runtime.Serv
})
mux.Handle("GET", pattern_WorkflowService_ListWorkflowTemplates_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_ListWorkflowTemplates_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_ListWorkflowTemplates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -924,6 +1018,8 @@ var (
pattern_WorkflowService_GetWorkflowTemplate_1 = 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, 1, 0, 4, 1, 5, 6}, []string{"apis", "v1beta1", "namespace", "workflow_templates", "uid", "versions", "version"}, "", 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)))
pattern_WorkflowService_ListWorkflowTemplates_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)))
)
var (
@@ -940,4 +1036,6 @@ var (
forward_WorkflowService_GetWorkflowTemplate_1 = runtime.ForwardResponseMessage
forward_WorkflowService_ListWorkflowTemplateVersions_0 = runtime.ForwardResponseMessage
forward_WorkflowService_ListWorkflowTemplates_0 = runtime.ForwardResponseMessage
)

View File

@@ -49,6 +49,12 @@ service WorkflowService {
get: "/apis/v1beta1/{namespace}/workflow_templates/{uid}/versions"
};
}
rpc ListWorkflowTemplates (ListWorkflowTemplatesRequest) returns (ListWorkflowTemplatesResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_templates"
};
}
}
message CreateWorkflowRequest {
@@ -72,8 +78,8 @@ message ListWorkflowsRequest {
}
message ListWorkflowsResponse {
repeated Workflow workflows = 1;
int32 count = 2;
int32 count = 1;
repeated Workflow workflows = 2;
}
message Workflow {

View File

@@ -12,6 +12,28 @@
],
"paths": {
"/apis/v1beta1/{namespace}/workflow_templates": {
"get": {
"operationId": "ListWorkflowTemplates",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/apiListWorkflowTemplatesResponse"
}
}
},
"parameters": [
{
"name": "namespace",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"WorkflowService"
]
},
"post": {
"operationId": "CreateWorkflowTemplate",
"responses": {
@@ -243,30 +265,45 @@
"apiListWorkflowTemplateVersionsResponse": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
},
"workflowTemplates": {
"type": "array",
"items": {
"$ref": "#/definitions/apiWorkflowTemplate"
}
}
}
},
"apiListWorkflowTemplatesResponse": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
},
"workflowTemplates": {
"type": "array",
"items": {
"$ref": "#/definitions/apiWorkflowTemplate"
}
}
}
},
"apiListWorkflowsResponse": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
},
"workflows": {
"type": "array",
"items": {
"$ref": "#/definitions/apiWorkflow"
}
},
"count": {
"type": "integer",
"format": "int32"
}
}
},

View File

@@ -170,8 +170,8 @@ func (m *ListWorkflowTemplateVersionsRequest) GetUid() string {
}
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"`
Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
WorkflowTemplates []*WorkflowTemplate `protobuf:"bytes,2,rep,name=workflowTemplates,proto3" json:"workflowTemplates,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -202,6 +202,13 @@ func (m *ListWorkflowTemplateVersionsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_ListWorkflowTemplateVersionsResponse proto.InternalMessageInfo
func (m *ListWorkflowTemplateVersionsResponse) GetCount() int32 {
if m != nil {
return m.Count
}
return 0
}
func (m *ListWorkflowTemplateVersionsResponse) GetWorkflowTemplates() []*WorkflowTemplate {
if m != nil {
return m.WorkflowTemplates
@@ -209,13 +216,92 @@ func (m *ListWorkflowTemplateVersionsResponse) GetWorkflowTemplates() []*Workflo
return nil
}
func (m *ListWorkflowTemplateVersionsResponse) GetCount() int32 {
type ListWorkflowTemplatesRequest struct {
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListWorkflowTemplatesRequest) Reset() { *m = ListWorkflowTemplatesRequest{} }
func (m *ListWorkflowTemplatesRequest) String() string { return proto.CompactTextString(m) }
func (*ListWorkflowTemplatesRequest) ProtoMessage() {}
func (*ListWorkflowTemplatesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_b9a07547748a96e8, []int{4}
}
func (m *ListWorkflowTemplatesRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListWorkflowTemplatesRequest.Unmarshal(m, b)
}
func (m *ListWorkflowTemplatesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListWorkflowTemplatesRequest.Marshal(b, m, deterministic)
}
func (m *ListWorkflowTemplatesRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListWorkflowTemplatesRequest.Merge(m, src)
}
func (m *ListWorkflowTemplatesRequest) XXX_Size() int {
return xxx_messageInfo_ListWorkflowTemplatesRequest.Size(m)
}
func (m *ListWorkflowTemplatesRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ListWorkflowTemplatesRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ListWorkflowTemplatesRequest proto.InternalMessageInfo
func (m *ListWorkflowTemplatesRequest) GetNamespace() string {
if m != nil {
return m.Namespace
}
return ""
}
type ListWorkflowTemplatesResponse struct {
Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
WorkflowTemplates []*WorkflowTemplate `protobuf:"bytes,2,rep,name=workflowTemplates,proto3" json:"workflowTemplates,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListWorkflowTemplatesResponse) Reset() { *m = ListWorkflowTemplatesResponse{} }
func (m *ListWorkflowTemplatesResponse) String() string { return proto.CompactTextString(m) }
func (*ListWorkflowTemplatesResponse) ProtoMessage() {}
func (*ListWorkflowTemplatesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_b9a07547748a96e8, []int{5}
}
func (m *ListWorkflowTemplatesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListWorkflowTemplatesResponse.Unmarshal(m, b)
}
func (m *ListWorkflowTemplatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListWorkflowTemplatesResponse.Marshal(b, m, deterministic)
}
func (m *ListWorkflowTemplatesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListWorkflowTemplatesResponse.Merge(m, src)
}
func (m *ListWorkflowTemplatesResponse) XXX_Size() int {
return xxx_messageInfo_ListWorkflowTemplatesResponse.Size(m)
}
func (m *ListWorkflowTemplatesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListWorkflowTemplatesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListWorkflowTemplatesResponse proto.InternalMessageInfo
func (m *ListWorkflowTemplatesResponse) GetCount() int32 {
if m != nil {
return m.Count
}
return 0
}
func (m *ListWorkflowTemplatesResponse) GetWorkflowTemplates() []*WorkflowTemplate {
if m != nil {
return m.WorkflowTemplates
}
return nil
}
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"`
@@ -230,7 +316,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{4}
return fileDescriptor_b9a07547748a96e8, []int{6}
}
func (m *WorkflowTemplate) XXX_Unmarshal(b []byte) error {
@@ -284,28 +370,31 @@ func init() {
proto.RegisterType((*GetWorkflowTemplateRequest)(nil), "api.GetWorkflowTemplateRequest")
proto.RegisterType((*ListWorkflowTemplateVersionsRequest)(nil), "api.ListWorkflowTemplateVersionsRequest")
proto.RegisterType((*ListWorkflowTemplateVersionsResponse)(nil), "api.ListWorkflowTemplateVersionsResponse")
proto.RegisterType((*ListWorkflowTemplatesRequest)(nil), "api.ListWorkflowTemplatesRequest")
proto.RegisterType((*ListWorkflowTemplatesResponse)(nil), "api.ListWorkflowTemplatesResponse")
proto.RegisterType((*WorkflowTemplate)(nil), "api.WorkflowTemplate")
}
func init() { proto.RegisterFile("workflow_template.proto", fileDescriptor_b9a07547748a96e8) }
var fileDescriptor_b9a07547748a96e8 = []byte{
// 266 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x3d, 0x4f, 0xc3, 0x30,
0x10, 0x95, 0x49, 0x03, 0xe4, 0x58, 0x82, 0x05, 0xc2, 0xaa, 0x40, 0x8a, 0x02, 0x43, 0xa6, 0x0c,
0xf0, 0x0b, 0x50, 0x07, 0x16, 0x26, 0x8b, 0x8f, 0x11, 0x99, 0x72, 0x91, 0x2c, 0x1a, 0xdb, 0xe4,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, 0x30, 0x6f, 0xaf, 0x8b, 0x4f, 0xe1, 0xb8, 0x56, 0x46,
0x57, 0x48, 0x5e, 0x4c, 0x82, 0xe2, 0x1f, 0xbf, 0x1f, 0x86, 0x17, 0x74, 0xf7, 0x17, 0x00, 0x00,
0xff, 0xff, 0xf9, 0x1d, 0xa0, 0xf0, 0x5c, 0x02, 0x00, 0x00,
// 286 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x52, 0xbf, 0x4f, 0xf3, 0x30,
0x10, 0x95, 0x9b, 0xe6, 0xfb, 0xc8, 0xb1, 0x04, 0x0b, 0x84, 0x55, 0xb5, 0x52, 0x64, 0x18, 0x32,
0x65, 0x80, 0x95, 0x05, 0x75, 0x60, 0x61, 0x8a, 0xf8, 0x31, 0x22, 0x53, 0x2e, 0x92, 0x45, 0x63,
0x9b, 0xd8, 0x21, 0x12, 0x13, 0xfc, 0xe7, 0xa8, 0x6e, 0x4a, 0xa5, 0x84, 0x20, 0x54, 0x89, 0xed,
0xce, 0x7e, 0xf7, 0xde, 0xf3, 0x3b, 0xc3, 0x71, 0xa3, 0xab, 0xe7, 0x62, 0xa9, 0x9b, 0x07, 0x87,
0xa5, 0x59, 0x0a, 0x87, 0x99, 0xa9, 0xb4, 0xd3, 0x34, 0x10, 0x46, 0xf2, 0x77, 0x02, 0xb3, 0x79,
0x85, 0xc2, 0xe1, 0x7d, 0x0b, 0xbb, 0x69, 0x51, 0x39, 0xbe, 0xd4, 0x68, 0x1d, 0x9d, 0x42, 0xa4,
0x44, 0x89, 0xd6, 0x88, 0x05, 0x32, 0x92, 0x90, 0x34, 0xca, 0xb7, 0x07, 0xf4, 0x12, 0xe2, 0xa6,
0x33, 0xc8, 0x46, 0x09, 0x49, 0xf7, 0xcf, 0x8e, 0x32, 0x61, 0x64, 0xd6, 0x63, 0xed, 0xc1, 0x79,
0x01, 0x93, 0x2b, 0x74, 0xbb, 0xc9, 0xc7, 0x10, 0xd4, 0xf2, 0xc9, 0x2b, 0x46, 0xf9, 0xaa, 0xa4,
0x0c, 0xfe, 0xbf, 0x62, 0x65, 0xa5, 0x56, 0x2c, 0x48, 0x48, 0x1a, 0xe6, 0x9b, 0x96, 0xdf, 0xc2,
0xc9, 0xb5, 0xb4, 0x3d, 0xa1, 0xbb, 0xf5, 0xb5, 0xdd, 0x51, 0x90, 0x7f, 0x10, 0x38, 0xfd, 0x99,
0xd7, 0x1a, 0xad, 0x2c, 0xd2, 0x43, 0x08, 0x17, 0xba, 0x56, 0xce, 0x93, 0x86, 0xf9, 0xba, 0xa1,
0x73, 0x38, 0xe8, 0x26, 0x62, 0xd9, 0x28, 0x09, 0x86, 0x13, 0xec, 0xe3, 0xf9, 0x05, 0x4c, 0xbf,
0xb3, 0xf0, 0xbb, 0x37, 0xf1, 0x37, 0x98, 0x0d, 0x4c, 0xff, 0xbd, 0x73, 0x05, 0x71, 0x17, 0xb6,
0xc9, 0x98, 0x6c, 0x97, 0x4a, 0x61, 0xbc, 0xb2, 0xdb, 0xc6, 0xee, 0xeb, 0xe1, 0x45, 0xd3, 0x09,
0xec, 0x95, 0x42, 0xc9, 0x02, 0xad, 0x63, 0x63, 0x3f, 0xf1, 0xd5, 0x3f, 0xfe, 0xf3, 0x7f, 0xff,
0xfc, 0x33, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x8f, 0xf0, 0x3d, 0x16, 0x03, 0x00, 0x00,
}

View File

@@ -19,8 +19,17 @@ message ListWorkflowTemplateVersionsRequest {
}
message ListWorkflowTemplateVersionsResponse {
repeated WorkflowTemplate workflowTemplates = 1;
int32 count = 2;
int32 count = 1;
repeated WorkflowTemplate workflowTemplates = 2;
}
message ListWorkflowTemplatesRequest {
string namespace = 1;
}
message ListWorkflowTemplatesResponse {
int32 count = 1;
repeated WorkflowTemplate workflowTemplates = 2;
}
message WorkflowTemplate {

View File

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

View File

@@ -60,12 +60,11 @@ func (r *WorkflowRepository) CreateWorkflowTemplate(namespace string, workflowTe
return workflowTemplate, nil
}
func (r *WorkflowRepository) workflowTemplatesSelectBuilder(namespace, uid string) sq.SelectBuilder {
func (r *WorkflowRepository) workflowTemplatesSelectBuilder(namespace string) sq.SelectBuilder {
sb := r.sb.Select("wt.uid", "wt.name", "wtv.version").
From("workflow_template_versions wtv").
Join("workflow_templates wt ON wt.id = wtv.workflow_template_id").
Where(sq.Eq{
"wt.uid": uid,
"wt.namespace": namespace,
}).
OrderBy("wtv.version desc")
@@ -76,7 +75,7 @@ func (r *WorkflowRepository) workflowTemplatesSelectBuilder(namespace, uid strin
func (r *WorkflowRepository) GetWorkflowTemplate(namespace, uid string, version int32) (workflowTemplate *model.WorkflowTemplate, err error) {
workflowTemplate = &model.WorkflowTemplate{}
sb := r.workflowTemplatesSelectBuilder(namespace, uid).Columns("wtv.manifest").Limit(1)
sb := r.workflowTemplatesSelectBuilder(namespace).Where(sq.Eq{"wt.uid": uid}).Columns("wtv.manifest").Limit(1)
if version != 0 {
sb = sb.Where(sq.Eq{"wtv.version": version})
}
@@ -97,7 +96,20 @@ func (r *WorkflowRepository) GetWorkflowTemplate(namespace, uid string, version
func (r *WorkflowRepository) ListWorkflowTemplateVersions(namespace, uid string) (workflowTemplateVersions []*model.WorkflowTemplate, err error) {
workflowTemplateVersions = []*model.WorkflowTemplate{}
query, args, err := r.workflowTemplatesSelectBuilder(namespace, uid).ToSql()
query, args, err := r.workflowTemplatesSelectBuilder(namespace).Where(sq.Eq{"wt.uid": uid}).ToSql()
if err != nil {
return
}
err = r.db.Select(&workflowTemplateVersions, query, args...)
return
}
func (r *WorkflowRepository) ListWorkflowTemplates(namespace string) (workflowTemplateVersions []*model.WorkflowTemplate, err error) {
workflowTemplateVersions = []*model.WorkflowTemplate{}
query, args, err := r.workflowTemplatesSelectBuilder(namespace).ToSql()
if err != nil {
return
}

View File

@@ -163,3 +163,20 @@ func (s *WorkflowServer) ListWorkflowTemplateVersions(ctx context.Context, req *
WorkflowTemplates: workflowTemplates,
}, nil
}
func (s *WorkflowServer) ListWorkflowTemplates(ctx context.Context, req *api.ListWorkflowTemplatesRequest) (*api.ListWorkflowTemplatesResponse, error) {
workflowTemplates, err := s.resourceManager.ListWorkflowTemplates(req.Namespace)
if errors.As(err, &userError) {
return nil, userError.GRPCError()
}
apiWorkflowTemplates := []*api.WorkflowTemplate{}
for _, wtv := range workflowTemplates {
apiWorkflowTemplates = append(apiWorkflowTemplates, apiWorkflowTemplate(wtv))
}
return &api.ListWorkflowTemplatesResponse{
Count: int32(len(apiWorkflowTemplates)),
WorkflowTemplates: apiWorkflowTemplates,
}, nil
}