From d3e5d9ea925ae68a2b2cc74e97217480e5e34c37 Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Thu, 25 Aug 2022 03:31:40 +0200 Subject: [PATCH] Wait for rpm import to finish in CLI Signed-off-by: Mustafa Gezen --- peridot/builder/v1/workflow/BUILD.bazel | 1 - peridot/builder/v1/workflow/lookaside.go | 128 ------------------ peridot/cmd/v1/peridot/BUILD.bazel | 1 - peridot/cmd/v1/peridot/build_rpm_import.go | 72 +++------- peridot/cmd/v1/peridot/lookaside_upload.go | 5 +- peridot/cmd/v1/peridotbuilder/main.go | 3 - peridot/cmd/v1/peridotephemeral/main.go | 1 - peridot/cmd/v1/peridotserver/BUILD.bazel | 3 + peridot/cmd/v1/peridotserver/main.go | 11 +- peridot/impl/v1/BUILD.bazel | 1 + peridot/impl/v1/project.go | 65 +++------ peridot/impl/v1/server.go | 7 +- peridot/proto/v1/project.proto | 4 +- utils/grpc.go | 13 +- .../peridotopenapi/BUILD.bazel | 1 + .../peridotopenapi/README.md | 1 + .../peridotopenapi/api_project_service.go | 12 +- ...model_v1_lookaside_file_upload_response.go | 115 ++++++++++++++++ 18 files changed, 199 insertions(+), 245 deletions(-) delete mode 100644 peridot/builder/v1/workflow/lookaside.go create mode 100644 vendor/openapi.peridot.resf.org/peridotopenapi/model_v1_lookaside_file_upload_response.go diff --git a/peridot/builder/v1/workflow/BUILD.bazel b/peridot/builder/v1/workflow/BUILD.bazel index 064d8b8d..05745149 100644 --- a/peridot/builder/v1/workflow/BUILD.bazel +++ b/peridot/builder/v1/workflow/BUILD.bazel @@ -8,7 +8,6 @@ go_library( "hashed_repositories.go", "import.go", "infrastructure.go", - "lookaside.go", "module.go", "rpmimport.go", "srpm.go", diff --git a/peridot/builder/v1/workflow/lookaside.go b/peridot/builder/v1/workflow/lookaside.go deleted file mode 100644 index 429fb5f9..00000000 --- a/peridot/builder/v1/workflow/lookaside.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) All respective contributors to the Peridot Project. All rights reserved. -// Copyright (c) 2021-2022 Rocky Enterprise Software Foundation, Inc. All rights reserved. -// Copyright (c) 2021-2022 Ctrl IQ, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors -// may be used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -package workflow - -import ( - "context" - "crypto/sha256" - "encoding/base64" - "encoding/hex" - "go.temporal.io/sdk/activity" - "go.temporal.io/sdk/temporal" - "go.temporal.io/sdk/workflow" - "peridot.resf.org/peridot/db/models" - peridotpb "peridot.resf.org/peridot/pb" - "strings" - "time" -) - -func (c *Controller) LookasideFileUploadWorkflow(ctx workflow.Context, req *peridotpb.LookasideFileUploadRequest, task *models.Task) (*peridotpb.LookasideFileUploadTask, error) { - ret := &peridotpb.LookasideFileUploadTask{} - deferTask, errorDetails, err := c.commonCreateTask(task, ret) - defer deferTask() - if err != nil { - return nil, err - } - - task.Status = peridotpb.TaskStatus_TASK_STATUS_FAILED - - uploadTaskQueue, cleanupWorker, err := c.provisionWorker(ctx, &ProvisionWorkerRequest{ - TaskId: task.ID.String(), - ParentTaskId: task.ParentTaskId, - Purpose: "lookaside", - Arch: "noarch", - }) - if err != nil { - setInternalError(errorDetails, err) - return nil, err - } - defer cleanupWorker() - - uploadCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{ - StartToCloseTimeout: time.Hour, - HeartbeatTimeout: 20 * time.Second, - TaskQueue: uploadTaskQueue, - RetryPolicy: &temporal.RetryPolicy{ - MaximumAttempts: 1, - }, - }) - err = workflow.ExecuteActivity(uploadCtx, c.LookasideFileUploadActivity, req, task.ID.String()).Get(ctx, ret) - if err != nil { - setActivityError(errorDetails, err) - return nil, err - } - - task.Status = peridotpb.TaskStatus_TASK_STATUS_SUCCEEDED - - return ret, nil -} - -func (c *Controller) LookasideFileUploadActivity(ctx context.Context, req *peridotpb.LookasideFileUploadRequest, taskID string) (*peridotpb.LookasideFileUploadTask, error) { - go func() { - for { - activity.RecordHeartbeat(ctx) - time.Sleep(4 * time.Second) - } - }() - - base64DecodedFile, err := base64.StdEncoding.DecodeString(req.File) - if err != nil { - return nil, err - } - - hasher := sha256.New() - _, err = hasher.Write(base64DecodedFile) - if err != nil { - return nil, err - } - sha256Sum := hex.EncodeToString(hasher.Sum(nil)) - - exists, err := c.storage.Exists(sha256Sum) - if err != nil { - if !strings.Contains(err.Error(), "NotFound") { - return nil, err - } - } - if exists { - return &peridotpb.LookasideFileUploadTask{ - Digest: sha256Sum, - }, nil - } - - _, err = c.storage.PutObjectBytes(sha256Sum, base64DecodedFile) - if err != nil { - return nil, err - } - - return &peridotpb.LookasideFileUploadTask{ - Digest: sha256Sum, - }, nil -} diff --git a/peridot/cmd/v1/peridot/BUILD.bazel b/peridot/cmd/v1/peridot/BUILD.bazel index 6001aca7..1a850e0c 100644 --- a/peridot/cmd/v1/peridot/BUILD.bazel +++ b/peridot/cmd/v1/peridot/BUILD.bazel @@ -18,7 +18,6 @@ go_library( importpath = "peridot.resf.org/peridot/cmd/v1/peridot", visibility = ["//visibility:private"], deps = [ - "//utils", "//vendor/github.com/sirupsen/logrus", "//vendor/github.com/spf13/cobra", "//vendor/github.com/spf13/viper", diff --git a/peridot/cmd/v1/peridot/build_rpm_import.go b/peridot/cmd/v1/peridot/build_rpm_import.go index 6a92341e..1036b63a 100644 --- a/peridot/cmd/v1/peridot/build_rpm_import.go +++ b/peridot/cmd/v1/peridot/build_rpm_import.go @@ -32,14 +32,11 @@ package main import ( "encoding/base64" - "encoding/json" - "fmt" "github.com/spf13/cobra" "io/ioutil" "log" "openapi.peridot.resf.org/peridotopenapi" "os" - "peridot.resf.org/utils" "time" ) @@ -86,7 +83,7 @@ func buildRpmImportMn(_ *cobra.Command, args []string) { } // Upload blobs to lookaside and wait for operation to finish - var operations []string + var blobs []string projectCl := getClient(serviceProject).(peridotopenapi.ProjectServiceApi) for _, arg := range args { bts, err := ioutil.ReadFile(arg) @@ -97,56 +94,12 @@ func buildRpmImportMn(_ *cobra.Command, args []string) { File: &base64EncodedBytes, }).Execute() errFatal(err) - log.Printf("Uploading %s to lookaside with task id %s\n", arg, res.GetTaskId()) - operations = append(operations, res.GetTaskId()) + log.Printf("Uploaded %s to lookaside", arg) + blobs = append(blobs, res.GetDigest()) } - log.Println("Waiting for upload tasks to finish...") - - // Wait for tasks to reach success state taskCl := getClient(serviceTask).(peridotopenapi.TaskServiceApi) - var doneOperations []string - var blobs []string - for { - didBreak := false - for _, op := range operations { - log.Printf("Waiting for %s to finish\n", op) - if len(doneOperations) == len(operations) { - didBreak = true - break - } - if utils.StrContains(op, doneOperations) { - continue - } - res, resp, err := taskCl.GetTask(getContext(), "global", op).Execute() - errFatal(err) - task := res.GetTask() - if task.GetDone() { - subtask := task.GetSubtasks()[0] - if subtask.GetStatus() == peridotopenapi.SUCCEEDED { - b, err := ioutil.ReadAll(resp.Body) - errFatal(err) - - var subtaskFull LookasideUploadTask - errFatal(json.Unmarshal(b, &subtaskFull)) - - blobs = append(blobs, subtaskFull.Task.Subtasks[0].Response.Digest) - doneOperations = append(doneOperations, op) - log.Printf("Task %s finished successfully\n", op) - } else if subtask.GetStatus() != peridotopenapi.RUNNING || subtask.GetStatus() != peridotopenapi.PENDING { - errFatal(fmt.Errorf("subtask %s failed with status %s", op, subtask.GetStatus())) - } - } - - time.Sleep(2 * time.Second) - } - if didBreak { - break - } - } - - log.Println("Upload tasks finished") log.Println("Triggering RPM batch import") cl := getClient(serviceBuild).(peridotopenapi.BuildServiceApi) @@ -156,4 +109,23 @@ func buildRpmImportMn(_ *cobra.Command, args []string) { ForceOverride: &buildRpmImportForceOverride, }).Execute() errFatal(err) + + // Wait for import to finish + log.Printf("Waiting for import %s to finish\n", importRes.GetTaskId()) + for { + res, _, err := taskCl.GetTask(getContext(), projectId, importRes.GetTaskId()).Execute() + errFatal(err) + task := res.GetTask() + if task.GetDone() { + if task.GetSubtasks()[0].GetStatus() == peridotopenapi.SUCCEEDED { + log.Printf("Import %s finished successfully\n", importRes.GetTaskId()) + break + } else { + log.Printf("Import %s failed with status %s\n", importRes.GetTaskId(), task.GetSubtasks()[0].GetStatus()) + break + } + } + + time.Sleep(5 * time.Second) + } } diff --git a/peridot/cmd/v1/peridot/lookaside_upload.go b/peridot/cmd/v1/peridot/lookaside_upload.go index 794f6263..623b3303 100644 --- a/peridot/cmd/v1/peridot/lookaside_upload.go +++ b/peridot/cmd/v1/peridot/lookaside_upload.go @@ -35,6 +35,7 @@ import ( "fmt" "github.com/spf13/cobra" "io/ioutil" + "log" "openapi.peridot.resf.org/peridotopenapi" "os" ) @@ -58,8 +59,10 @@ func lookasideUploadMn(_ *cobra.Command, args []string) { base64EncodedBytes := base64.StdEncoding.EncodeToString(bts) cl := getClient(serviceProject).(peridotopenapi.ProjectServiceApi) - _, _, err = cl.LookasideFileUpload(getContext()).Body(peridotopenapi.V1LookasideFileUploadRequest{ + res, _, err := cl.LookasideFileUpload(getContext()).Body(peridotopenapi.V1LookasideFileUploadRequest{ File: &base64EncodedBytes, }).Execute() errFatal(err) + + log.Printf("Digest: %s", res.GetDigest()) } diff --git a/peridot/cmd/v1/peridotbuilder/main.go b/peridot/cmd/v1/peridotbuilder/main.go index eabd2ce8..fc3c8994 100644 --- a/peridot/cmd/v1/peridotbuilder/main.go +++ b/peridot/cmd/v1/peridotbuilder/main.go @@ -158,9 +158,6 @@ func mn(_ *cobra.Command, _ []string) { // RPM Import w.Worker.RegisterActivity(w.WorkflowController.RpmImportActivity) - // Lookaside - w.Worker.RegisterActivity(w.WorkflowController.LookasideFileUploadActivity) - // Yumrepofs w.Worker.RegisterActivity(w.WorkflowController.CreateHashedRepositoriesActivity) diff --git a/peridot/cmd/v1/peridotephemeral/main.go b/peridot/cmd/v1/peridotephemeral/main.go index db3b3c64..55988d56 100644 --- a/peridot/cmd/v1/peridotephemeral/main.go +++ b/peridot/cmd/v1/peridotephemeral/main.go @@ -106,7 +106,6 @@ func mn(_ *cobra.Command, _ []string) { w.Worker.RegisterWorkflow(w.WorkflowController.RpmImportWorkflow) w.Worker.RegisterWorkflow(w.WorkflowController.RpmLookasideBatchImportWorkflow) w.Worker.RegisterWorkflow(w.WorkflowController.CreateHashedRepositoriesWorkflow) - w.Worker.RegisterWorkflow(w.WorkflowController.LookasideFileUploadWorkflow) } w.Worker.RegisterWorkflow(w.WorkflowController.ProvisionWorkerWorkflow) w.Worker.RegisterWorkflow(w.WorkflowController.DestroyWorkerWorkflow) diff --git a/peridot/cmd/v1/peridotserver/BUILD.bazel b/peridot/cmd/v1/peridotserver/BUILD.bazel index c4ef0787..5ef4f704 100644 --- a/peridot/cmd/v1/peridotserver/BUILD.bazel +++ b/peridot/cmd/v1/peridotserver/BUILD.bazel @@ -6,10 +6,13 @@ go_library( importpath = "peridot.resf.org/peridot/cmd/v1/peridotserver", visibility = ["//visibility:private"], deps = [ + "//peridot/common", "//peridot/db/connector", "//peridot/impl/v1:impl", + "//peridot/lookaside/s3", "//temporalutils", "//utils", + "//vendor/github.com/go-git/go-billy/v5/osfs", "//vendor/github.com/sirupsen/logrus", "//vendor/github.com/spf13/cobra", "//vendor/go.temporal.io/sdk/client", diff --git a/peridot/cmd/v1/peridotserver/main.go b/peridot/cmd/v1/peridotserver/main.go index cd81770f..09bb7bbe 100644 --- a/peridot/cmd/v1/peridotserver/main.go +++ b/peridot/cmd/v1/peridotserver/main.go @@ -31,11 +31,14 @@ package main import ( + "github.com/go-git/go-billy/v5/osfs" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "go.temporal.io/sdk/client" + peridotcommon "peridot.resf.org/peridot/common" serverconnector "peridot.resf.org/peridot/db/connector" peridotimplv1 "peridot.resf.org/peridot/impl/v1" + "peridot.resf.org/peridot/lookaside/s3" "peridot.resf.org/temporalutils" "peridot.resf.org/utils" ) @@ -54,6 +57,7 @@ func init() { cnf.DatabaseName = &dname cnf.Name = "peridot" + peridotcommon.AddFlags(root.PersistentFlags()) utils.AddFlags(root.PersistentFlags(), cnf) } @@ -64,7 +68,12 @@ func mn(_ *cobra.Command, _ []string) { } defer c.Close() - s, err := peridotimplv1.NewServer(serverconnector.MustAuto(), c) + storage, err := s3.New(osfs.New("/")) + if err != nil { + logrus.Fatalln("unable to create S3 storage", err) + } + + s, err := peridotimplv1.NewServer(serverconnector.MustAuto(), c, storage) if err != nil { logrus.Fatalf("could not init server: %v", err) } diff --git a/peridot/impl/v1/BUILD.bazel b/peridot/impl/v1/BUILD.bazel index b5443d60..ec48a0cf 100644 --- a/peridot/impl/v1/BUILD.bazel +++ b/peridot/impl/v1/BUILD.bazel @@ -18,6 +18,7 @@ go_library( "//peridot/builder/v1/workflow", "//peridot/db", "//peridot/db/models", + "//peridot/lookaside", "//peridot/proto/v1:pb", "//proto:common", "//servicecatalog", diff --git a/peridot/impl/v1/project.go b/peridot/impl/v1/project.go index 972685d5..5aa0100c 100644 --- a/peridot/impl/v1/project.go +++ b/peridot/impl/v1/project.go @@ -32,7 +32,10 @@ package peridotimplv1 import ( "context" + "crypto/sha256" "database/sql" + "encoding/base64" + "encoding/hex" v1 "github.com/authzed/authzed-go/proto/authzed/api/v1" "go.temporal.io/sdk/client" "google.golang.org/grpc/codes" @@ -404,7 +407,7 @@ func (s *Server) CreateHashedRepositories(ctx context.Context, req *peridotpb.Cr }, nil } -func (s *Server) LookasideFileUpload(ctx context.Context, req *peridotpb.LookasideFileUploadRequest) (*peridotpb.AsyncTask, error) { +func (s *Server) LookasideFileUpload(ctx context.Context, req *peridotpb.LookasideFileUploadRequest) (*peridotpb.LookasideFileUploadResponse, error) { if err := req.Validate(); err != nil { return nil, err } @@ -412,60 +415,36 @@ func (s *Server) LookasideFileUpload(ctx context.Context, req *peridotpb.Lookasi return nil, err } - user, err := utils.UserFromContext(ctx) + base64DecodedFile, err := base64.StdEncoding.DecodeString(req.File) if err != nil { return nil, err } - rollback := true - beginTx, err := s.db.Begin() + hasher := sha256.New() + _, err = hasher.Write(base64DecodedFile) if err != nil { - s.log.Error(err) - return nil, utils.InternalError + return nil, err } - defer func() { - if rollback { - _ = beginTx.Rollback() + sha256Sum := hex.EncodeToString(hasher.Sum(nil)) + + exists, err := s.storage.Exists(sha256Sum) + if err != nil { + if !strings.Contains(err.Error(), "NotFound") { + return nil, err } - }() - tx := s.db.UseTransaction(beginTx) - - task, err := tx.CreateTask(user, "noarch", peridotpb.TaskType_TASK_TYPE_LOOKASIDE_FILE_UPLOAD, nil, nil) - if err != nil { - s.log.Errorf("could not create task: %v", err) - return nil, utils.InternalError + } + if exists { + return &peridotpb.LookasideFileUploadResponse{ + Digest: sha256Sum, + }, nil } - taskProto, err := task.ToProto(false) + _, err = s.storage.PutObjectBytes(sha256Sum, base64DecodedFile) if err != nil { - return nil, status.Errorf(codes.Internal, "could not marshal task: %v", err) - } - - rollback = false - err = beginTx.Commit() - if err != nil { - return nil, status.Error(codes.Internal, "could not save, try again") - } - - _, err = s.temporal.ExecuteWorkflow( - context.Background(), - client.StartWorkflowOptions{ - ID: task.ID.String(), - TaskQueue: MainTaskQueue, - }, - s.temporalWorker.WorkflowController.LookasideFileUploadWorkflow, - req, - task, - ) - if err != nil { - s.log.Errorf("could not start workflow: %v", err) - _ = s.db.SetTaskStatus(task.ID.String(), peridotpb.TaskStatus_TASK_STATUS_FAILED) return nil, err } - return &peridotpb.AsyncTask{ - TaskId: task.ID.String(), - Subtasks: []*peridotpb.Subtask{taskProto}, - Done: false, + return &peridotpb.LookasideFileUploadResponse{ + Digest: sha256Sum, }, nil } diff --git a/peridot/impl/v1/server.go b/peridot/impl/v1/server.go index 2fc7f1a2..39f4c6ed 100644 --- a/peridot/impl/v1/server.go +++ b/peridot/impl/v1/server.go @@ -47,6 +47,7 @@ import ( commonpb "peridot.resf.org/common" builderv1 "peridot.resf.org/peridot/builder/v1" peridotdb "peridot.resf.org/peridot/db" + "peridot.resf.org/peridot/lookaside" peridotpb "peridot.resf.org/peridot/pb" "peridot.resf.org/servicecatalog" "peridot.resf.org/utils" @@ -89,9 +90,10 @@ type Server struct { authz *authzed.Client hydra *hydraclient.OryHydra hydraAdmin *hydraclient.OryHydra + storage lookaside.Storage } -func NewServer(db peridotdb.Access, c client.Client) (*Server, error) { +func NewServer(db peridotdb.Access, c client.Client, storage lookaside.Storage) (*Server, error) { temporalWorker, err := builderv1.NewWorker(db, c, MainTaskQueue, nil) if err != nil { return nil, err @@ -130,6 +132,7 @@ func NewServer(db peridotdb.Access, c client.Client) (*Server, error) { authz: authz, hydra: hydraSDK, hydraAdmin: hydraAdminSDK, + storage: storage, }, nil } @@ -152,11 +155,11 @@ func (s *Server) Run() { &utils.GRPCOptions{ DialOptions: []grpc.DialOption{ grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024 * 1024 * 1024)), }, ServerOptions: []grpc.ServerOption{ grpc.UnaryInterceptor(s.interceptor), grpc.StreamInterceptor(s.serverInterceptor), + grpc.MaxRecvMsgSize(1024 * 1024 * 1024), }, }, func(r *utils.Register) { diff --git a/peridot/proto/v1/project.proto b/peridot/proto/v1/project.proto index 0f739042..f1b357da 100644 --- a/peridot/proto/v1/project.proto +++ b/peridot/proto/v1/project.proto @@ -76,7 +76,7 @@ service ProjectService { }; } - rpc LookasideFileUpload(LookasideFileUploadRequest) returns (resf.peridot.v1.AsyncTask) { + rpc LookasideFileUpload(LookasideFileUploadRequest) returns (LookasideFileUploadResponse) { option (google.api.http) = { post: "/v1/lookaside" body: "*" @@ -302,6 +302,6 @@ message CreateHashedRepositoriesTask { message LookasideFileUploadRequest { string file = 1 [(validate.rules).string.min_bytes = 1]; } -message LookasideFileUploadTask { +message LookasideFileUploadResponse { string digest = 1; } diff --git a/utils/grpc.go b/utils/grpc.go index 1952b0b2..1c00ae41 100644 --- a/utils/grpc.go +++ b/utils/grpc.go @@ -153,6 +153,13 @@ func NewGRPCServer(goptions *GRPCOptions, endpoint func(*Register), serve func(* } } + opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} + // use DialOptions if not nil + if options.DialOptions != nil { + opts = options.DialOptions + } + opts = append(opts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1000*1024*1024), grpc.MaxCallSendMsgSize(1000*1024*1024))) + serv := grpc.NewServer(options.ServerOptions...) // background context since this is the "main" app @@ -178,12 +185,6 @@ func NewGRPCServer(goptions *GRPCOptions, endpoint func(*Register), serve func(* } mux := runtime.NewServeMux(muxOptions...) - opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} - // use DialOptions if not nil - if options.DialOptions != nil { - opts = options.DialOptions - } - opts = append(opts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1000*1024*1024), grpc.MaxCallSendMsgSize(1000*1024*1024))) register := &Register{ Context: ctx, diff --git a/vendor/openapi.peridot.resf.org/peridotopenapi/BUILD.bazel b/vendor/openapi.peridot.resf.org/peridotopenapi/BUILD.bazel index 7af28f2e..3b43507c 100644 --- a/vendor/openapi.peridot.resf.org/peridotopenapi/BUILD.bazel +++ b/vendor/openapi.peridot.resf.org/peridotopenapi/BUILD.bazel @@ -57,6 +57,7 @@ go_library( "model_v1_list_repositories_response.go", "model_v1_list_tasks_response.go", "model_v1_lookaside_file_upload_request.go", + "model_v1_lookaside_file_upload_response.go", "model_v1_package.go", "model_v1_package_filters.go", "model_v1_package_type.go", diff --git a/vendor/openapi.peridot.resf.org/peridotopenapi/README.md b/vendor/openapi.peridot.resf.org/peridotopenapi/README.md index 2a14026f..646472ec 100644 --- a/vendor/openapi.peridot.resf.org/peridotopenapi/README.md +++ b/vendor/openapi.peridot.resf.org/peridotopenapi/README.md @@ -161,6 +161,7 @@ Class | Method | HTTP request | Description - [V1ListRepositoriesResponse](docs/V1ListRepositoriesResponse.md) - [V1ListTasksResponse](docs/V1ListTasksResponse.md) - [V1LookasideFileUploadRequest](docs/V1LookasideFileUploadRequest.md) + - [V1LookasideFileUploadResponse](docs/V1LookasideFileUploadResponse.md) - [V1Package](docs/V1Package.md) - [V1PackageFilters](docs/V1PackageFilters.md) - [V1PackageType](docs/V1PackageType.md) diff --git a/vendor/openapi.peridot.resf.org/peridotopenapi/api_project_service.go b/vendor/openapi.peridot.resf.org/peridotopenapi/api_project_service.go index 4589179d..66920696 100644 --- a/vendor/openapi.peridot.resf.org/peridotopenapi/api_project_service.go +++ b/vendor/openapi.peridot.resf.org/peridotopenapi/api_project_service.go @@ -132,9 +132,9 @@ type ProjectServiceApi interface { /* * LookasideFileUploadExecute executes the request - * @return V1AsyncTask + * @return V1LookasideFileUploadResponse */ - LookasideFileUploadExecute(r ApiLookasideFileUploadRequest) (V1AsyncTask, *_nethttp.Response, error) + LookasideFileUploadExecute(r ApiLookasideFileUploadRequest) (V1LookasideFileUploadResponse, *_nethttp.Response, error) /* * SetProjectCredentials Method for SetProjectCredentials @@ -1009,7 +1009,7 @@ func (r ApiLookasideFileUploadRequest) Body(body V1LookasideFileUploadRequest) A return r } -func (r ApiLookasideFileUploadRequest) Execute() (V1AsyncTask, *_nethttp.Response, error) { +func (r ApiLookasideFileUploadRequest) Execute() (V1LookasideFileUploadResponse, *_nethttp.Response, error) { return r.ApiService.LookasideFileUploadExecute(r) } @@ -1027,16 +1027,16 @@ func (a *ProjectServiceApiService) LookasideFileUpload(ctx _context.Context) Api /* * Execute executes the request - * @return V1AsyncTask + * @return V1LookasideFileUploadResponse */ -func (a *ProjectServiceApiService) LookasideFileUploadExecute(r ApiLookasideFileUploadRequest) (V1AsyncTask, *_nethttp.Response, error) { +func (a *ProjectServiceApiService) LookasideFileUploadExecute(r ApiLookasideFileUploadRequest) (V1LookasideFileUploadResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue V1AsyncTask + localVarReturnValue V1LookasideFileUploadResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectServiceApiService.LookasideFileUpload") diff --git a/vendor/openapi.peridot.resf.org/peridotopenapi/model_v1_lookaside_file_upload_response.go b/vendor/openapi.peridot.resf.org/peridotopenapi/model_v1_lookaside_file_upload_response.go new file mode 100644 index 00000000..0ca4ffbd --- /dev/null +++ b/vendor/openapi.peridot.resf.org/peridotopenapi/model_v1_lookaside_file_upload_response.go @@ -0,0 +1,115 @@ +/* + * peridot/proto/v1/batch.proto + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: version not set + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package peridotopenapi + +import ( + "encoding/json" +) + +// V1LookasideFileUploadResponse struct for V1LookasideFileUploadResponse +type V1LookasideFileUploadResponse struct { + Digest *string `json:"digest,omitempty"` +} + +// NewV1LookasideFileUploadResponse instantiates a new V1LookasideFileUploadResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewV1LookasideFileUploadResponse() *V1LookasideFileUploadResponse { + this := V1LookasideFileUploadResponse{} + return &this +} + +// NewV1LookasideFileUploadResponseWithDefaults instantiates a new V1LookasideFileUploadResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewV1LookasideFileUploadResponseWithDefaults() *V1LookasideFileUploadResponse { + this := V1LookasideFileUploadResponse{} + return &this +} + +// GetDigest returns the Digest field value if set, zero value otherwise. +func (o *V1LookasideFileUploadResponse) GetDigest() string { + if o == nil || o.Digest == nil { + var ret string + return ret + } + return *o.Digest +} + +// GetDigestOk returns a tuple with the Digest field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1LookasideFileUploadResponse) GetDigestOk() (*string, bool) { + if o == nil || o.Digest == nil { + return nil, false + } + return o.Digest, true +} + +// HasDigest returns a boolean if a field has been set. +func (o *V1LookasideFileUploadResponse) HasDigest() bool { + if o != nil && o.Digest != nil { + return true + } + + return false +} + +// SetDigest gets a reference to the given string and assigns it to the Digest field. +func (o *V1LookasideFileUploadResponse) SetDigest(v string) { + o.Digest = &v +} + +func (o V1LookasideFileUploadResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Digest != nil { + toSerialize["digest"] = o.Digest + } + return json.Marshal(toSerialize) +} + +type NullableV1LookasideFileUploadResponse struct { + value *V1LookasideFileUploadResponse + isSet bool +} + +func (v NullableV1LookasideFileUploadResponse) Get() *V1LookasideFileUploadResponse { + return v.value +} + +func (v *NullableV1LookasideFileUploadResponse) Set(val *V1LookasideFileUploadResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1LookasideFileUploadResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1LookasideFileUploadResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1LookasideFileUploadResponse(val *V1LookasideFileUploadResponse) *NullableV1LookasideFileUploadResponse { + return &NullableV1LookasideFileUploadResponse{value: val, isSet: true} +} + +func (v NullableV1LookasideFileUploadResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1LookasideFileUploadResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +