diff --git a/Dockerfile b/Dockerfile index c76708d..332e735 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,11 @@ EXPOSE 49618 WORKDIR /go/src/oc-catalog ####################################################### -RUN go get github.com/beego/bee/v2 + +COPY go.mod . +COPY go.sum . + +RUN go get github.com/beego/bee/v2 && go install github.com/beego/bee/v2@master # Manually download swagger during build RUN ["/bin/bash", "-c", \ @@ -21,8 +25,6 @@ RUN ["/bin/bash", "-c", \ curl -sL https://github.com/beego/swagger/archive/v3.tar.gz | tar xvvvz --overwrite -C swagger --strip-components=1"] -COPY go.mod . -COPY go.sum . RUN go mod download -x # COPY . . diff --git a/README.md b/README.md index ccfb89a..781d0cf 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,17 @@ # OC Catalog -OpenCloud Catalog API +## OpenCloud Catalog API +Uses the Beego framework + +To install the Beego bee command : + + go install github.com/beego/bee/v2@master + +To build and run : + + go mod tidy + bee run -downdoc=true -gendoc=true ## Full deploy @@ -11,6 +21,8 @@ Deploy with docker: and populate DB (or other scripts) with: `docker exec -it oc-catalog_oc-catalog_1 ./scripts/populate_models.sh ./scripts/demo.json` +or out of docker `./scripts/populate_models.sh ./scripts/demo.json` + ## Dev Start DB with `docker-compose up -d` and run the API with `bee run -downdoc=true -gendoc=true` diff --git a/controllers/schedule.go b/controllers/schedule.go index 545323c..28efc05 100644 --- a/controllers/schedule.go +++ b/controllers/schedule.go @@ -94,7 +94,7 @@ func (u *ScheduleController) CheckSchedule(cron string, duration uint, startDate // @Param startDate query time.Time true "Start date" // @Param stopDate query time.Time true "End date" // @Success 200 {object} []models.ScheduleDB -// @Success 201 Too much elements within the range of dates +// @Success 201 Too many elements within the range of dates // @Failure 403 Authentication issue // @Failure 400 Other error. Check the output // // @Security jwtAPIToken diff --git a/models/computing.go b/models/computing.go index 5169077..fb0aac2 100644 --- a/models/computing.go +++ b/models/computing.go @@ -27,22 +27,30 @@ type RepositoryModel struct { } type ComputingNEWModel struct { - Description string `json:"description" required:"true"` + Description string `json:"description,omitempty" required:"true"` Name string `json:"name,omitempty" required:"true" validate:"required" description:"Name of the computing"` - ShortDescription string `json:"short_description" required:"true" validate:"required"` - Logo string `json:"logo" required:"true" validate:"required"` + ShortDescription string `json:"short_description,omitempty" required:"true" validate:"required"` + Logo string `json:"logo,omitempty" required:"true" validate:"required"` Type string `json:"type,omitempty" required:"true"` - Owner string `json:"owner"` - License string `json:"license"` - Price uint `json:"price"` + Owner string `json:"owner,omitempty"` + License string `json:"license,omitempty"` + Price uint `json:"price,omitempty"` - ExecutionRequirements ExecutionRequirementsModel `json:"execution_requirements"` + ExecutionRequirements ExecutionRequirementsModel `json:"execution_requirements,omitempty"` - Dinputs []string - Doutputs []string + Dinputs []string `json:"dinputs,omitempty"` + Doutputs []string `json:"doutputs,omitempty"` - Repository RepositoryModel `json:"repository"` + Image string `json:"image,omitempty"` + Command string `json:"command,omitempty"` + Arguments []string `json:"arguments,omitempty"` + Environment []string `json:"environment,omitempty"` + Ports []string `json:"ports,omitempty"` + + CustomDeployment string `json:"custom_deployment,omitempty"` + + Repository RepositoryModel `json:"repository,omitempty"` } type ComputingModel struct { diff --git a/models/workflow.go b/models/workflow.go index 526ee2b..5a39887 100644 --- a/models/workflow.go +++ b/models/workflow.go @@ -506,7 +506,8 @@ func ParseMxGraph(username, workflowName, xmlData string) (err error, mxissues [ } if currentWorkflow.Schedules.IsBooked { - return errors.New("Can't modify a booked workflow"), nil + //well, let's allow that + //return errors.New("Can't modify a booked workflow"), nil } var xmlModel MxGraphModel diff --git a/scripts/local_imgs/Thumbs.db b/scripts/local_imgs/Thumbs.db new file mode 100644 index 0000000..cf5a03d Binary files /dev/null and b/scripts/local_imgs/Thumbs.db differ diff --git a/scripts/local_imgs/Thumbs.db:encryptable b/scripts/local_imgs/Thumbs.db:encryptable new file mode 100644 index 0000000..e69de29 diff --git a/scripts/populate_models.sh b/scripts/populate_models.sh index 9bed980..cc85dd4 100755 --- a/scripts/populate_models.sh +++ b/scripts/populate_models.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/bash # Must specify a JSON with a following structure: