mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-09-27 01:56:03 +08:00
feat: updated presigned url response to include the file size so client can decide if it can be displayed or not
This commit is contained in:
@@ -729,7 +729,7 @@
|
||||
},
|
||||
"/apis/v1beta1/{namespace}/files/presigned-url/{key}": {
|
||||
"get": {
|
||||
"operationId": "GetObjectPresignedUrl",
|
||||
"operationId": "GetObjectDownloadPresignedUrl",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
@@ -1361,48 +1361,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/artifacts/{key}": {
|
||||
"get": {
|
||||
"operationId": "GetArtifact",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ArtifactResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/google.rpc.Status"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "namespace",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "uid",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "key",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"WorkflowService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/cron_start_statistics": {
|
||||
"post": {
|
||||
"operationId": "CronStartWorkflowExecutionStatistic",
|
||||
@@ -3302,15 +3260,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"ArtifactResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CreateWorkflowExecutionBody": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3503,6 +3452,10 @@
|
||||
"properties": {
|
||||
"url": {
|
||||
"type": "string"
|
||||
},
|
||||
"size": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -339,7 +339,8 @@ type GetPresignedUrlResponse struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
|
||||
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
|
||||
Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetPresignedUrlResponse) Reset() {
|
||||
@@ -381,6 +382,13 @@ func (x *GetPresignedUrlResponse) GetUrl() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetPresignedUrlResponse) GetSize() int64 {
|
||||
if x != nil {
|
||||
return x.Size
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_files_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_files_proto_rawDesc = []byte{
|
||||
@@ -423,30 +431,32 @@ var file_files_proto_rawDesc = []byte{
|
||||
0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x22, 0x2b, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e,
|
||||
0x65, 0x79, 0x22, 0x3f, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e,
|
||||
0x65, 0x64, 0x55, 0x72, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x32,
|
||||
0x9c, 0x02, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||
0x98, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x72, 0x65,
|
||||
0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x55, 0x72, 0x6c, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e,
|
||||
0x65, 0x64, 0x55, 0x72, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61,
|
||||
0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x55,
|
||||
0x72, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x82, 0xd3, 0xe4, 0x93,
|
||||
0x02, 0x38, 0x12, 0x36, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
|
||||
0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x2d, 0x75, 0x72,
|
||||
0x6c, 0x2f, 0x7b, 0x6b, 0x65, 0x79, 0x3d, 0x2a, 0x2a, 0x7d, 0x12, 0x72, 0x0a, 0x09, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
|
||||
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e,
|
||||
0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73,
|
||||
0x69, 0x7a, 0x65, 0x32, 0xa4, 0x02, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x12, 0xa0, 0x01, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63,
|
||||
0x74, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e,
|
||||
0x65, 0x64, 0x55, 0x72, 0x6c, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x4f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x55, 0x72,
|
||||
0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x50, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x55, 0x72, 0x6c, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x38, 0x12, 0x36,
|
||||
0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2f,
|
||||
0x6c, 0x69, 0x73, 0x74, 0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x3d, 0x2a, 0x2a, 0x7d, 0x42, 0x24,
|
||||
0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x65,
|
||||
0x70, 0x61, 0x6e, 0x65, 0x6c, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x69,
|
||||
0x2f, 0x67, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x70, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x2d, 0x75, 0x72, 0x6c, 0x2f, 0x7b, 0x6b,
|
||||
0x65, 0x79, 0x3d, 0x2a, 0x2a, 0x7d, 0x12, 0x72, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69,
|
||||
0x6c, 0x65, 0x73, 0x12, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69,
|
||||
0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x61, 0x70, 0x69,
|
||||
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x61, 0x70, 0x69,
|
||||
0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73,
|
||||
0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2f, 0x6c, 0x69, 0x73, 0x74,
|
||||
0x2f, 0x7b, 0x70, 0x61, 0x74, 0x68, 0x3d, 0x2a, 0x2a, 0x7d, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69,
|
||||
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x65, 0x70, 0x61, 0x6e, 0x65,
|
||||
0x6c, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -471,9 +481,9 @@ var file_files_proto_goTypes = []interface{}{
|
||||
}
|
||||
var file_files_proto_depIdxs = []int32{
|
||||
0, // 0: api.ListFilesResponse.files:type_name -> api.File
|
||||
3, // 1: api.FileService.GetObjectPresignedUrl:input_type -> api.GetObjectPresignedUrlRequest
|
||||
3, // 1: api.FileService.GetObjectDownloadPresignedUrl:input_type -> api.GetObjectPresignedUrlRequest
|
||||
1, // 2: api.FileService.ListFiles:input_type -> api.ListFilesRequest
|
||||
4, // 3: api.FileService.GetObjectPresignedUrl:output_type -> api.GetPresignedUrlResponse
|
||||
4, // 3: api.FileService.GetObjectDownloadPresignedUrl:output_type -> api.GetPresignedUrlResponse
|
||||
2, // 4: api.FileService.ListFiles:output_type -> api.ListFilesResponse
|
||||
3, // [3:5] is the sub-list for method output_type
|
||||
1, // [1:3] is the sub-list for method input_type
|
||||
|
@@ -31,7 +31,7 @@ var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = metadata.Join
|
||||
|
||||
func request_FileService_GetObjectPresignedUrl_0(ctx context.Context, marshaler runtime.Marshaler, client FileServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
func request_FileService_GetObjectDownloadPresignedUrl_0(ctx context.Context, marshaler runtime.Marshaler, client FileServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetObjectPresignedUrlRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
@@ -62,12 +62,12 @@ func request_FileService_GetObjectPresignedUrl_0(ctx context.Context, marshaler
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "key", err)
|
||||
}
|
||||
|
||||
msg, err := client.GetObjectPresignedUrl(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
msg, err := client.GetObjectDownloadPresignedUrl(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_FileService_GetObjectPresignedUrl_0(ctx context.Context, marshaler runtime.Marshaler, server FileServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
func local_request_FileService_GetObjectDownloadPresignedUrl_0(ctx context.Context, marshaler runtime.Marshaler, server FileServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetObjectPresignedUrlRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
@@ -98,7 +98,7 @@ func local_request_FileService_GetObjectPresignedUrl_0(ctx context.Context, mars
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "key", err)
|
||||
}
|
||||
|
||||
msg, err := server.GetObjectPresignedUrl(ctx, &protoReq)
|
||||
msg, err := server.GetObjectDownloadPresignedUrl(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
@@ -199,18 +199,18 @@ func local_request_FileService_ListFiles_0(ctx context.Context, marshaler runtim
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterFileServiceHandlerFromEndpoint instead.
|
||||
func RegisterFileServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FileServiceServer) error {
|
||||
|
||||
mux.Handle("GET", pattern_FileService_GetObjectPresignedUrl_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
mux.Handle("GET", pattern_FileService_GetObjectDownloadPresignedUrl_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/api.FileService/GetObjectPresignedUrl")
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/api.FileService/GetObjectDownloadPresignedUrl")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_FileService_GetObjectPresignedUrl_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
resp, md, err := local_request_FileService_GetObjectDownloadPresignedUrl_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
@@ -218,7 +218,7 @@ func RegisterFileServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
|
||||
return
|
||||
}
|
||||
|
||||
forward_FileService_GetObjectPresignedUrl_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
forward_FileService_GetObjectDownloadPresignedUrl_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
@@ -286,23 +286,23 @@ func RegisterFileServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn
|
||||
// "FileServiceClient" to call the correct interceptors.
|
||||
func RegisterFileServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FileServiceClient) error {
|
||||
|
||||
mux.Handle("GET", pattern_FileService_GetObjectPresignedUrl_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
mux.Handle("GET", pattern_FileService_GetObjectDownloadPresignedUrl_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, "/api.FileService/GetObjectPresignedUrl")
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/api.FileService/GetObjectDownloadPresignedUrl")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_FileService_GetObjectPresignedUrl_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
resp, md, err := request_FileService_GetObjectDownloadPresignedUrl_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_FileService_GetObjectPresignedUrl_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
forward_FileService_GetObjectDownloadPresignedUrl_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
@@ -330,13 +330,13 @@ func RegisterFileServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_FileService_GetObjectPresignedUrl_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 4, 3, 0, 4, 1, 5, 5}, []string{"apis", "v1beta1", "namespace", "files", "presigned-url", "key"}, ""))
|
||||
pattern_FileService_GetObjectDownloadPresignedUrl_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 4, 3, 0, 4, 1, 5, 5}, []string{"apis", "v1beta1", "namespace", "files", "presigned-url", "key"}, ""))
|
||||
|
||||
pattern_FileService_ListFiles_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 2, 4, 3, 0, 4, 1, 5, 5}, []string{"apis", "v1beta1", "namespace", "files", "list", "path"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_FileService_GetObjectPresignedUrl_0 = runtime.ForwardResponseMessage
|
||||
forward_FileService_GetObjectDownloadPresignedUrl_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_FileService_ListFiles_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
@@ -17,7 +17,7 @@ const _ = grpc.SupportPackageIsVersion7
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type FileServiceClient interface {
|
||||
GetObjectPresignedUrl(ctx context.Context, in *GetObjectPresignedUrlRequest, opts ...grpc.CallOption) (*GetPresignedUrlResponse, error)
|
||||
GetObjectDownloadPresignedUrl(ctx context.Context, in *GetObjectPresignedUrlRequest, opts ...grpc.CallOption) (*GetPresignedUrlResponse, error)
|
||||
ListFiles(ctx context.Context, in *ListFilesRequest, opts ...grpc.CallOption) (*ListFilesResponse, error)
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ func NewFileServiceClient(cc grpc.ClientConnInterface) FileServiceClient {
|
||||
return &fileServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *fileServiceClient) GetObjectPresignedUrl(ctx context.Context, in *GetObjectPresignedUrlRequest, opts ...grpc.CallOption) (*GetPresignedUrlResponse, error) {
|
||||
func (c *fileServiceClient) GetObjectDownloadPresignedUrl(ctx context.Context, in *GetObjectPresignedUrlRequest, opts ...grpc.CallOption) (*GetPresignedUrlResponse, error) {
|
||||
out := new(GetPresignedUrlResponse)
|
||||
err := c.cc.Invoke(ctx, "/api.FileService/GetObjectPresignedUrl", in, out, opts...)
|
||||
err := c.cc.Invoke(ctx, "/api.FileService/GetObjectDownloadPresignedUrl", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -51,7 +51,7 @@ func (c *fileServiceClient) ListFiles(ctx context.Context, in *ListFilesRequest,
|
||||
// All implementations must embed UnimplementedFileServiceServer
|
||||
// for forward compatibility
|
||||
type FileServiceServer interface {
|
||||
GetObjectPresignedUrl(context.Context, *GetObjectPresignedUrlRequest) (*GetPresignedUrlResponse, error)
|
||||
GetObjectDownloadPresignedUrl(context.Context, *GetObjectPresignedUrlRequest) (*GetPresignedUrlResponse, error)
|
||||
ListFiles(context.Context, *ListFilesRequest) (*ListFilesResponse, error)
|
||||
mustEmbedUnimplementedFileServiceServer()
|
||||
}
|
||||
@@ -60,8 +60,8 @@ type FileServiceServer interface {
|
||||
type UnimplementedFileServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedFileServiceServer) GetObjectPresignedUrl(context.Context, *GetObjectPresignedUrlRequest) (*GetPresignedUrlResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetObjectPresignedUrl not implemented")
|
||||
func (UnimplementedFileServiceServer) GetObjectDownloadPresignedUrl(context.Context, *GetObjectPresignedUrlRequest) (*GetPresignedUrlResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetObjectDownloadPresignedUrl not implemented")
|
||||
}
|
||||
func (UnimplementedFileServiceServer) ListFiles(context.Context, *ListFilesRequest) (*ListFilesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListFiles not implemented")
|
||||
@@ -79,20 +79,20 @@ func RegisterFileServiceServer(s grpc.ServiceRegistrar, srv FileServiceServer) {
|
||||
s.RegisterService(&_FileService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _FileService_GetObjectPresignedUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _FileService_GetObjectDownloadPresignedUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetObjectPresignedUrlRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(FileServiceServer).GetObjectPresignedUrl(ctx, in)
|
||||
return srv.(FileServiceServer).GetObjectDownloadPresignedUrl(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/api.FileService/GetObjectPresignedUrl",
|
||||
FullMethod: "/api.FileService/GetObjectDownloadPresignedUrl",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FileServiceServer).GetObjectPresignedUrl(ctx, req.(*GetObjectPresignedUrlRequest))
|
||||
return srv.(FileServiceServer).GetObjectDownloadPresignedUrl(ctx, req.(*GetObjectPresignedUrlRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -120,8 +120,8 @@ var _FileService_serviceDesc = grpc.ServiceDesc{
|
||||
HandlerType: (*FileServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetObjectPresignedUrl",
|
||||
Handler: _FileService_GetObjectPresignedUrl_Handler,
|
||||
MethodName: "GetObjectDownloadPresignedUrl",
|
||||
Handler: _FileService_GetObjectDownloadPresignedUrl_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListFiles",
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -709,98 +709,6 @@ func local_request_WorkflowService_TerminateWorkflowExecution_0(ctx context.Cont
|
||||
|
||||
}
|
||||
|
||||
func request_WorkflowService_GetArtifact_0(ctx context.Context, marshaler runtime.Marshaler, client WorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetArtifactRequest
|
||||
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)
|
||||
}
|
||||
|
||||
val, ok = pathParams["key"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "key")
|
||||
}
|
||||
|
||||
protoReq.Key, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "key", err)
|
||||
}
|
||||
|
||||
msg, err := client.GetArtifact(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_WorkflowService_GetArtifact_0(ctx context.Context, marshaler runtime.Marshaler, server WorkflowServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetArtifactRequest
|
||||
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)
|
||||
}
|
||||
|
||||
val, ok = pathParams["key"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "key")
|
||||
}
|
||||
|
||||
protoReq.Key, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "key", err)
|
||||
}
|
||||
|
||||
msg, err := server.GetArtifact(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_WorkflowService_AddWorkflowExecutionStatistics_0(ctx context.Context, marshaler runtime.Marshaler, client WorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq AddWorkflowExecutionStatisticRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@@ -1517,29 +1425,6 @@ func RegisterWorkflowServiceHandlerServer(ctx context.Context, mux *runtime.Serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_WorkflowService_GetArtifact_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/api.WorkflowService/GetArtifact")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_WorkflowService_GetArtifact_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_WorkflowService_GetArtifact_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_WorkflowService_AddWorkflowExecutionStatistics_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -1919,26 +1804,6 @@ func RegisterWorkflowServiceHandlerClient(ctx context.Context, mux *runtime.Serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_WorkflowService_GetArtifact_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, "/api.WorkflowService/GetArtifact")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_WorkflowService_GetArtifact_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_GetArtifact_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_WorkflowService_AddWorkflowExecutionStatistics_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -2083,8 +1948,6 @@ var (
|
||||
|
||||
pattern_WorkflowService_TerminateWorkflowExecution_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_executions", "uid", "terminate"}, ""))
|
||||
|
||||
pattern_WorkflowService_GetArtifact_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, 3, 0, 4, 1, 5, 6}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "artifacts", "key"}, ""))
|
||||
|
||||
pattern_WorkflowService_AddWorkflowExecutionStatistics_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_executions", "uid", "statistics"}, ""))
|
||||
|
||||
pattern_WorkflowService_CronStartWorkflowExecutionStatistic_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_executions", "uid", "cron_start_statistics"}, ""))
|
||||
@@ -2119,8 +1982,6 @@ var (
|
||||
|
||||
forward_WorkflowService_TerminateWorkflowExecution_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_WorkflowService_GetArtifact_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_WorkflowService_AddWorkflowExecutionStatistics_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_WorkflowService_CronStartWorkflowExecutionStatistic_0 = runtime.ForwardResponseMessage
|
||||
|
@@ -30,7 +30,6 @@ type WorkflowServiceClient interface {
|
||||
GetWorkflowExecutionMetrics(ctx context.Context, in *GetWorkflowExecutionMetricsRequest, opts ...grpc.CallOption) (*GetWorkflowExecutionMetricsResponse, error)
|
||||
ResubmitWorkflowExecution(ctx context.Context, in *ResubmitWorkflowExecutionRequest, opts ...grpc.CallOption) (*WorkflowExecution, error)
|
||||
TerminateWorkflowExecution(ctx context.Context, in *TerminateWorkflowExecutionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
GetArtifact(ctx context.Context, in *GetArtifactRequest, opts ...grpc.CallOption) (*ArtifactResponse, error)
|
||||
AddWorkflowExecutionStatistics(ctx context.Context, in *AddWorkflowExecutionStatisticRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
CronStartWorkflowExecutionStatistic(ctx context.Context, in *CronStartWorkflowExecutionStatisticRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
UpdateWorkflowExecutionStatus(ctx context.Context, in *UpdateWorkflowExecutionStatusRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
@@ -183,15 +182,6 @@ func (c *workflowServiceClient) TerminateWorkflowExecution(ctx context.Context,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *workflowServiceClient) GetArtifact(ctx context.Context, in *GetArtifactRequest, opts ...grpc.CallOption) (*ArtifactResponse, error) {
|
||||
out := new(ArtifactResponse)
|
||||
err := c.cc.Invoke(ctx, "/api.WorkflowService/GetArtifact", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *workflowServiceClient) AddWorkflowExecutionStatistics(ctx context.Context, in *AddWorkflowExecutionStatisticRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, "/api.WorkflowService/AddWorkflowExecutionStatistics", in, out, opts...)
|
||||
@@ -262,7 +252,6 @@ type WorkflowServiceServer interface {
|
||||
GetWorkflowExecutionMetrics(context.Context, *GetWorkflowExecutionMetricsRequest) (*GetWorkflowExecutionMetricsResponse, error)
|
||||
ResubmitWorkflowExecution(context.Context, *ResubmitWorkflowExecutionRequest) (*WorkflowExecution, error)
|
||||
TerminateWorkflowExecution(context.Context, *TerminateWorkflowExecutionRequest) (*emptypb.Empty, error)
|
||||
GetArtifact(context.Context, *GetArtifactRequest) (*ArtifactResponse, error)
|
||||
AddWorkflowExecutionStatistics(context.Context, *AddWorkflowExecutionStatisticRequest) (*emptypb.Empty, error)
|
||||
CronStartWorkflowExecutionStatistic(context.Context, *CronStartWorkflowExecutionStatisticRequest) (*emptypb.Empty, error)
|
||||
UpdateWorkflowExecutionStatus(context.Context, *UpdateWorkflowExecutionStatusRequest) (*emptypb.Empty, error)
|
||||
@@ -306,9 +295,6 @@ func (UnimplementedWorkflowServiceServer) ResubmitWorkflowExecution(context.Cont
|
||||
func (UnimplementedWorkflowServiceServer) TerminateWorkflowExecution(context.Context, *TerminateWorkflowExecutionRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method TerminateWorkflowExecution not implemented")
|
||||
}
|
||||
func (UnimplementedWorkflowServiceServer) GetArtifact(context.Context, *GetArtifactRequest) (*ArtifactResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetArtifact not implemented")
|
||||
}
|
||||
func (UnimplementedWorkflowServiceServer) AddWorkflowExecutionStatistics(context.Context, *AddWorkflowExecutionStatisticRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AddWorkflowExecutionStatistics not implemented")
|
||||
}
|
||||
@@ -526,24 +512,6 @@ func _WorkflowService_TerminateWorkflowExecution_Handler(srv interface{}, ctx co
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _WorkflowService_GetArtifact_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetArtifactRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(WorkflowServiceServer).GetArtifact(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/api.WorkflowService/GetArtifact",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(WorkflowServiceServer).GetArtifact(ctx, req.(*GetArtifactRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _WorkflowService_AddWorkflowExecutionStatistics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AddWorkflowExecutionStatisticRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -688,10 +656,6 @@ var _WorkflowService_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "TerminateWorkflowExecution",
|
||||
Handler: _WorkflowService_TerminateWorkflowExecution_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetArtifact",
|
||||
Handler: _WorkflowService_GetArtifact_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AddWorkflowExecutionStatistics",
|
||||
Handler: _WorkflowService_AddWorkflowExecutionStatistics_Handler,
|
||||
|
@@ -6,7 +6,7 @@ option go_package = "github.com/onepanelio/core/api/gen";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
service FileService {
|
||||
rpc GetObjectPresignedUrl (GetObjectPresignedUrlRequest) returns (GetPresignedUrlResponse) {
|
||||
rpc GetObjectDownloadPresignedUrl (GetObjectPresignedUrlRequest) returns (GetPresignedUrlResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/apis/v1beta1/{namespace}/files/presigned-url/{key=**}"
|
||||
};
|
||||
@@ -52,4 +52,5 @@ message GetObjectPresignedUrlRequest {
|
||||
|
||||
message GetPresignedUrlResponse {
|
||||
string url = 1;
|
||||
int64 size = 2;
|
||||
}
|
@@ -74,12 +74,6 @@ service WorkflowService {
|
||||
};
|
||||
}
|
||||
|
||||
rpc GetArtifact (GetArtifactRequest) returns (ArtifactResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/artifacts/{key=**}"
|
||||
};
|
||||
}
|
||||
|
||||
rpc AddWorkflowExecutionStatistics (AddWorkflowExecutionStatisticRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/statistics"
|
||||
@@ -229,10 +223,6 @@ message WorkflowExecution {
|
||||
repeated Metric metrics = 12;
|
||||
}
|
||||
|
||||
message ArtifactResponse {
|
||||
bytes data = 1;
|
||||
}
|
||||
|
||||
message Statistics {
|
||||
string workflowStatus = 1;
|
||||
int64 workflowTemplateId = 2;
|
||||
|
28
pkg/files.go
28
pkg/files.go
@@ -2,6 +2,7 @@ package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/minio/minio-go/v6"
|
||||
"github.com/onepanelio/core/pkg/util"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"google.golang.org/grpc/codes"
|
||||
@@ -10,6 +11,12 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// GetPresignedUrlDownload represents the information available when downloading an object
|
||||
type GetPresignedUrlDownload struct {
|
||||
URL string
|
||||
Size int64
|
||||
}
|
||||
|
||||
// ListFiles returns an array of files for the given namespace/key
|
||||
func (c *Client) ListFiles(namespace, key string) (files []*File, err error) {
|
||||
config, err := c.GetNamespaceConfig(namespace)
|
||||
@@ -63,7 +70,7 @@ func (c *Client) ListFiles(namespace, key string) (files []*File, err error) {
|
||||
}
|
||||
|
||||
// GetObjectPresignedURL generates a presigned url for the object that is valid for 24 hours.
|
||||
func (c *Client) GetObjectPresignedURL(namespace, key string) (objectPresignedURL string, err error) {
|
||||
func (c *Client) GetObjectPresignedURL(namespace, key string) (download *GetPresignedUrlDownload, err error) {
|
||||
config, err := c.GetNamespaceConfig(namespace)
|
||||
if err != nil {
|
||||
return
|
||||
@@ -74,6 +81,16 @@ func (c *Client) GetObjectPresignedURL(namespace, key string) (objectPresignedUR
|
||||
return
|
||||
}
|
||||
|
||||
objInfo, err := s3Client.StatObject(config.ArtifactRepository.S3.Bucket, key, minio.StatObjectOptions{})
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Namespace": namespace,
|
||||
"Key": key,
|
||||
"Error": err.Error(),
|
||||
}).Error("StatObject")
|
||||
return
|
||||
}
|
||||
|
||||
reqParams := make(url.Values)
|
||||
reqParams.Set("response-content-disposition", fmt.Sprintf("attachment; filename=\"%s\"", key))
|
||||
presignedURL, err := s3Client.PresignedGetObject(config.ArtifactRepository.S3.Bucket, key, time.Hour*24, reqParams)
|
||||
@@ -82,11 +99,12 @@ func (c *Client) GetObjectPresignedURL(namespace, key string) (objectPresignedUR
|
||||
"Namespace": namespace,
|
||||
"Key": key,
|
||||
"Error": err.Error(),
|
||||
}).Error("Artifact does not exist.")
|
||||
}).Error("PresignedGetObject")
|
||||
return
|
||||
}
|
||||
|
||||
objectPresignedURL = presignedURL.String()
|
||||
|
||||
return
|
||||
return &GetPresignedUrlDownload{
|
||||
URL: presignedURL.String(),
|
||||
Size: objInfo.Size,
|
||||
}, nil
|
||||
}
|
||||
|
@@ -1675,66 +1675,6 @@ func (c *Client) TerminateWorkflowExecution(namespace, uid string) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) GetArtifact(namespace, uid, key string) (data []byte, err error) {
|
||||
config, err := c.GetNamespaceConfig(namespace)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var (
|
||||
stream io.ReadCloser
|
||||
)
|
||||
switch {
|
||||
case config.ArtifactRepository.S3 != nil:
|
||||
{
|
||||
s3Client, err := c.GetS3Client(namespace, config.ArtifactRepository.S3)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
opts := s3.GetObjectOptions{}
|
||||
stream, err = s3Client.GetObject(config.ArtifactRepository.S3.Bucket, key, opts)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Namespace": namespace,
|
||||
"UID": uid,
|
||||
"Key": key,
|
||||
"Error": err.Error(),
|
||||
}).Error("Artifact does not exist.")
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
case config.ArtifactRepository.GCS != nil:
|
||||
{
|
||||
gcsClient, err := c.GetGCSClient(namespace, config.ArtifactRepository.GCS)
|
||||
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Namespace": namespace,
|
||||
"UID": uid,
|
||||
"Error": err.Error(),
|
||||
}).Error("Artifact does not exist.")
|
||||
return nil, util.NewUserError(codes.NotFound, "Artifact does not exist.")
|
||||
}
|
||||
stream, err = gcsClient.GetObject(config.ArtifactRepository.GCS.Bucket, key)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"Namespace": namespace,
|
||||
"UID": uid,
|
||||
"Error": err.Error(),
|
||||
}).Error("Artifact does not exist.")
|
||||
return nil, util.NewUserError(codes.NotFound, "Artifact does not exist.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data, err = ioutil.ReadAll(stream)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func filterOutCustomTypesFromManifest(manifest []byte) (result []byte, err error) {
|
||||
data := make(map[string]interface{})
|
||||
err = yaml.Unmarshal(manifest, &data)
|
||||
|
@@ -96,7 +96,8 @@ func (s *FileServer) ListFiles(ctx context.Context, req *api.ListFilesRequest) (
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *FileServer) GetObjectPresignedUrl(ctx context.Context, req *api.GetObjectPresignedUrlRequest) (*api.GetPresignedUrlResponse, error) {
|
||||
// GetObjectDownloadPresignedUrl returns a downloadable url for a given object
|
||||
func (s *FileServer) GetObjectDownloadPresignedUrl(ctx context.Context, req *api.GetObjectPresignedUrlRequest) (*api.GetPresignedUrlResponse, error) {
|
||||
// TODO resource is workflows for now, should it be something else?
|
||||
client := getClient(ctx)
|
||||
allowed, err := auth.IsAuthorized(client, req.Namespace, "list", "argoproj.io", "workflows", "")
|
||||
@@ -104,12 +105,13 @@ func (s *FileServer) GetObjectPresignedUrl(ctx context.Context, req *api.GetObje
|
||||
return nil, err
|
||||
}
|
||||
|
||||
signedURL, err := client.GetObjectPresignedURL(req.Namespace, req.Key)
|
||||
downloadObj, err := client.GetObjectPresignedURL(req.Namespace, req.Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &api.GetPresignedUrlResponse{
|
||||
Url: signedURL,
|
||||
Url: downloadObj.URL,
|
||||
Size: downloadObj.Size,
|
||||
}, nil
|
||||
}
|
||||
|
@@ -449,23 +449,6 @@ func (s *WorkflowServer) TerminateWorkflowExecution(ctx context.Context, req *ap
|
||||
return &empty.Empty{}, nil
|
||||
}
|
||||
|
||||
func (s *WorkflowServer) GetArtifact(ctx context.Context, req *api.GetArtifactRequest) (*api.ArtifactResponse, error) {
|
||||
client := getClient(ctx)
|
||||
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Uid)
|
||||
if err != nil || !allowed {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data, err := client.GetArtifact(req.Namespace, req.Uid, req.Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &api.ArtifactResponse{
|
||||
Data: data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *WorkflowServer) UpdateWorkflowExecutionStatus(ctx context.Context, req *api.UpdateWorkflowExecutionStatusRequest) (*empty.Empty, error) {
|
||||
client := getClient(ctx)
|
||||
allowed, err := auth.IsAuthorized(client, req.Namespace, "update", "argoproj.io", "workflows", req.Uid)
|
||||
|
Reference in New Issue
Block a user