diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 23f09161a2ed54d62e2917adf46697c9a66befaf..7ba775a534d64291955648e24da611f3c5a3cd99 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,65 +1,31 @@ -variables: - HELPERS_FILE: docker-build.yml - HELM_HELPERS_FILE: helm.yml - APP_HELM_NAME: infohub - DOCKER_FILE: deployment/ci/Dockerfile - stages: - - compile - test - - build - - helm - - deploy -include: - - project: "${HELPERS_PATH}" - file: "${HELPERS_FILE}" - - template: "Workflows/Branch-Pipelines.gitlab-ci.yml" - - project: "$HELM_HELPERS_PATH}" - file: "${HELM_HELPERS_FILE}" +before_script: + - ln -s /builds /go/src/gitlab.eclipse.org + - cd /go/src/gitlab.eclipse.org/${CI_PROJECT_PATH} -lint: - image: golangci/golangci-lint:v1.50.1 +linters: + image: golangci/golangci-lint:latest stage: test - tags: - - amd64-docker script: + - go version - golangci-lint --version - golangci-lint run - before_script: - - ln -s /builds /go/src/gitlab.com - - cd /go/src/gitlab.com/${CI_PROJECT_PATH} unit tests: - image: golang:1.20.5 - extends: .gotest + image: golang:1.21.3 stage: test - tags: - - amd64-docker - before_script: [] + script: + - go version + - go test -race ./... -coverprofile=coverage.out + - go tool cover -func=coverage.out coverage: '/total:\s+\(statements\)\s+(\d+.\d+\%)/' govulncheck: - image: golang:1.20.5 + image: golang:1.21.3 stage: test - tags: - - amd64-docker - before_script: - - ln -s /builds /go/src/gitlab.com - - cd /go/src/gitlab.com/${CI_PROJECT_PATH} script: - go version - go install golang.org/x/vuln/cmd/govulncheck@latest - govulncheck ./... - -amd64: - extends: .docker-build - stage: build - tags: - - amd64-docker - -helm-lint: - extends: .helm-lint - stage: helm - tags: - - amd64-docker diff --git a/.gitlab-ci.yml.old b/.gitlab-ci.yml.old deleted file mode 100644 index 592893b3e171df71a6fc19e87e9f0e303b61235e..0000000000000000000000000000000000000000 --- a/.gitlab-ci.yml.old +++ /dev/null @@ -1,25 +0,0 @@ -stages: - - test - -before_script: - - ln -s /builds /go/src/gitlab.com - - cd /go/src/gitlab.com/${CI_PROJECT_PATH} - -lint: - image: golangci/golangci-lint:v1.46.2 - stage: test - tags: - - amd64-docker - script: - - golangci-lint --version - - golangci-lint run - -unit tests: - image: golang:1.17.10 - stage: test - tags: - - amd64-docker - script: - - go version - - go test -race ./... -coverprofile=coverage.out - - go tool cover -func=coverage.out diff --git a/cmd/infohub/main.go b/cmd/infohub/main.go index 1d6cb878ef6c6c426c4789864438cbd06f74d663..8a58c2be1a07dd670634b671d60a397483a2a2fe 100644 --- a/cmd/infohub/main.go +++ b/cmd/infohub/main.go @@ -107,7 +107,7 @@ func main() { ) { infohubSvc = infohub.New(storage, policy, cache, credentials, signer, logger) - healthSvc = health.New() + healthSvc = health.New(Version) } // create endpoints diff --git a/deployment/ci/Dockerfile b/deployment/ci/Dockerfile index e2c4fda167917f5d2c1f9cc7e7bcf82444d1f8fb..77e903272335759218187b89a02220cdf03fa16d 100644 --- a/deployment/ci/Dockerfile +++ b/deployment/ci/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.5-alpine3.17 as builder +FROM golang:1.21.3-alpine3.17 as builder RUN apk add git diff --git a/deployment/compose/Dockerfile b/deployment/compose/Dockerfile index 0112ba71c845bf0feabddaf26f9c6ac0ede16f3a..fbef3883765dbe544b05fe021cea8078ab68e700 100644 --- a/deployment/compose/Dockerfile +++ b/deployment/compose/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.5 +FROM golang:1.21.3 ENV GO111MODULE=on diff --git a/design/design.go b/design/design.go index 7389f2e5197f06bfd6edbe797ee0bb863340795a..8dc9a59d0a53ed9f5c9171f9ad7c687fe982f131 100644 --- a/design/design.go +++ b/design/design.go @@ -45,7 +45,7 @@ var _ = Service("health", func() { Method("Liveness", func() { Payload(Empty) - Result(Empty) + Result(HealthResponse) HTTP(func() { GET("/liveness") Response(StatusOK) @@ -54,7 +54,7 @@ var _ = Service("health", func() { Method("Readiness", func() { Payload(Empty) - Result(Empty) + Result(HealthResponse) HTTP(func() { GET("/readiness") Response(StatusOK) diff --git a/design/types.go b/design/types.go index 20f542cbd0e7461399e39f1b2db548866a2f8725..93e17042a07221eda60d6e5096f9b7d9d48cebb1 100644 --- a/design/types.go +++ b/design/types.go @@ -23,3 +23,10 @@ var ImportResult = Type("ImportResult", func() { }) Required("importIds") }) + +var HealthResponse = Type("HealthResponse", func() { + Field(1, "service", String, "Service name.") + Field(2, "status", String, "Status message.") + Field(3, "version", String, "Service runtime version.") + Required("service", "status", "version") +}) diff --git a/gen/health/client.go b/gen/health/client.go index 9980a08855d0054b2382017fabf756bfc57be6df..65d2c1776ba9030157d4cc422853d7b0c59a930c 100644 --- a/gen/health/client.go +++ b/gen/health/client.go @@ -28,13 +28,21 @@ func NewClient(liveness, readiness goa.Endpoint) *Client { } // Liveness calls the "Liveness" endpoint of the "health" service. -func (c *Client) Liveness(ctx context.Context) (err error) { - _, err = c.LivenessEndpoint(ctx, nil) - return +func (c *Client) Liveness(ctx context.Context) (res *HealthResponse, err error) { + var ires any + ires, err = c.LivenessEndpoint(ctx, nil) + if err != nil { + return + } + return ires.(*HealthResponse), nil } // Readiness calls the "Readiness" endpoint of the "health" service. -func (c *Client) Readiness(ctx context.Context) (err error) { - _, err = c.ReadinessEndpoint(ctx, nil) - return +func (c *Client) Readiness(ctx context.Context) (res *HealthResponse, err error) { + var ires any + ires, err = c.ReadinessEndpoint(ctx, nil) + if err != nil { + return + } + return ires.(*HealthResponse), nil } diff --git a/gen/health/endpoints.go b/gen/health/endpoints.go index e8f909dd236ac6e60d8741b21da28b9dc6b26f21..44b17ff6019dbebe7e287a0b4e15c9603bd280e6 100644 --- a/gen/health/endpoints.go +++ b/gen/health/endpoints.go @@ -37,7 +37,7 @@ func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint) { // "Liveness" of service "health". func NewLivenessEndpoint(s Service) goa.Endpoint { return func(ctx context.Context, req any) (any, error) { - return nil, s.Liveness(ctx) + return s.Liveness(ctx) } } @@ -45,6 +45,6 @@ func NewLivenessEndpoint(s Service) goa.Endpoint { // "Readiness" of service "health". func NewReadinessEndpoint(s Service) goa.Endpoint { return func(ctx context.Context, req any) (any, error) { - return nil, s.Readiness(ctx) + return s.Readiness(ctx) } } diff --git a/gen/health/service.go b/gen/health/service.go index f1a85278c820a630b0fa6f213110c5dc042282af..31d7cd46e8f1da943ff001ea7aa9fc6e34a9f901 100644 --- a/gen/health/service.go +++ b/gen/health/service.go @@ -14,9 +14,9 @@ import ( // Health service provides health check endpoints. type Service interface { // Liveness implements Liveness. - Liveness(context.Context) (err error) + Liveness(context.Context) (res *HealthResponse, err error) // Readiness implements Readiness. - Readiness(context.Context) (err error) + Readiness(context.Context) (res *HealthResponse, err error) } // ServiceName is the name of the service as defined in the design. This is the @@ -28,3 +28,13 @@ const ServiceName = "health" // are the same values that are set in the endpoint request contexts under the // MethodKey key. var MethodNames = [2]string{"Liveness", "Readiness"} + +// HealthResponse is the result type of the health service Liveness method. +type HealthResponse struct { + // Service name. + Service string + // Status message. + Status string + // Service runtime version. + Version string +} diff --git a/gen/http/cli/infohub/cli.go b/gen/http/cli/infohub/cli.go index 52dbc9335daecb5af8e551d47a2ac0fb2b8ea6dc..1becb790390e782671a35f6f6994650d3d229075 100644 --- a/gen/http/cli/infohub/cli.go +++ b/gen/http/cli/infohub/cli.go @@ -23,15 +23,15 @@ import ( // // command (subcommand1|subcommand2|...) func UsageCommands() string { - return `health (liveness|readiness) -infohub (export|import) + return `infohub (export|import) +health (liveness|readiness) ` } // UsageExamples produces an example of a valid invocation of the CLI tool. func UsageExamples() string { - return os.Args[0] + ` health liveness` + "\n" + - os.Args[0] + ` infohub export --export-name "testexport"` + "\n" + + return os.Args[0] + ` infohub export --export-name "testexport"` + "\n" + + os.Args[0] + ` health liveness` + "\n" + "" } @@ -45,12 +45,6 @@ func ParseEndpoint( restore bool, ) (goa.Endpoint, any, error) { var ( - healthFlags = flag.NewFlagSet("health", flag.ContinueOnError) - - healthLivenessFlags = flag.NewFlagSet("liveness", flag.ExitOnError) - - healthReadinessFlags = flag.NewFlagSet("readiness", flag.ExitOnError) - infohubFlags = flag.NewFlagSet("infohub", flag.ContinueOnError) infohubExportFlags = flag.NewFlagSet("export", flag.ExitOnError) @@ -58,15 +52,21 @@ func ParseEndpoint( infohubImportFlags = flag.NewFlagSet("import", flag.ExitOnError) infohubImportBodyFlag = infohubImportFlags.String("body", "REQUIRED", "") - ) - healthFlags.Usage = healthUsage - healthLivenessFlags.Usage = healthLivenessUsage - healthReadinessFlags.Usage = healthReadinessUsage + healthFlags = flag.NewFlagSet("health", flag.ContinueOnError) + + healthLivenessFlags = flag.NewFlagSet("liveness", flag.ExitOnError) + + healthReadinessFlags = flag.NewFlagSet("readiness", flag.ExitOnError) + ) infohubFlags.Usage = infohubUsage infohubExportFlags.Usage = infohubExportUsage infohubImportFlags.Usage = infohubImportUsage + healthFlags.Usage = healthUsage + healthLivenessFlags.Usage = healthLivenessUsage + healthReadinessFlags.Usage = healthReadinessUsage + if err := flag.CommandLine.Parse(os.Args[1:]); err != nil { return nil, nil, err } @@ -82,10 +82,10 @@ func ParseEndpoint( { svcn = flag.Arg(0) switch svcn { - case "health": - svcf = healthFlags case "infohub": svcf = infohubFlags + case "health": + svcf = healthFlags default: return nil, nil, fmt.Errorf("unknown service %q", svcn) } @@ -101,16 +101,6 @@ func ParseEndpoint( { epn = svcf.Arg(0) switch svcn { - case "health": - switch epn { - case "liveness": - epf = healthLivenessFlags - - case "readiness": - epf = healthReadinessFlags - - } - case "infohub": switch epn { case "export": @@ -121,6 +111,16 @@ func ParseEndpoint( } + case "health": + switch epn { + case "liveness": + epf = healthLivenessFlags + + case "readiness": + epf = healthReadinessFlags + + } + } } if epf == nil { @@ -141,16 +141,6 @@ func ParseEndpoint( ) { switch svcn { - case "health": - c := healthc.NewClient(scheme, host, doer, enc, dec, restore) - switch epn { - case "liveness": - endpoint = c.Liveness() - data = nil - case "readiness": - endpoint = c.Readiness() - data = nil - } case "infohub": c := infohubc.NewClient(scheme, host, doer, enc, dec, restore) switch epn { @@ -161,6 +151,16 @@ func ParseEndpoint( endpoint = c.Import() data, err = infohubc.BuildImportPayload(*infohubImportBodyFlag) } + case "health": + c := healthc.NewClient(scheme, host, doer, enc, dec, restore) + switch epn { + case "liveness": + endpoint = c.Liveness() + data = nil + case "readiness": + endpoint = c.Readiness() + data = nil + } } } if err != nil { @@ -170,72 +170,72 @@ func ParseEndpoint( return endpoint, data, nil } -// healthUsage displays the usage of the health command and its subcommands. -func healthUsage() { - fmt.Fprintf(os.Stderr, `Health service provides health check endpoints. +// infohubUsage displays the usage of the infohub command and its subcommands. +func infohubUsage() { + fmt.Fprintf(os.Stderr, `Information Hub Service enables exporting and importing information. Usage: - %[1]s [globalflags] health COMMAND [flags] + %[1]s [globalflags] infohub COMMAND [flags] COMMAND: - liveness: Liveness implements Liveness. - readiness: Readiness implements Readiness. + export: Export returns data signed as Verifiable Presentation. + import: Import the given data wrapped as Verifiable Presentation into the Cache. Additional help: - %[1]s health COMMAND --help + %[1]s infohub COMMAND --help `, os.Args[0]) } -func healthLivenessUsage() { - fmt.Fprintf(os.Stderr, `%[1]s [flags] health liveness +func infohubExportUsage() { + fmt.Fprintf(os.Stderr, `%[1]s [flags] infohub export -export-name STRING -Liveness implements Liveness. +Export returns data signed as Verifiable Presentation. + -export-name STRING: Name of export to be performed. Example: - %[1]s health liveness + %[1]s infohub export --export-name "testexport" `, os.Args[0]) } -func healthReadinessUsage() { - fmt.Fprintf(os.Stderr, `%[1]s [flags] health readiness +func infohubImportUsage() { + fmt.Fprintf(os.Stderr, `%[1]s [flags] infohub import -body STRING -Readiness implements Readiness. +Import the given data wrapped as Verifiable Presentation into the Cache. + -body STRING: Example: - %[1]s health readiness + %[1]s infohub import --body "data" `, os.Args[0]) } -// infohubUsage displays the usage of the infohub command and its subcommands. -func infohubUsage() { - fmt.Fprintf(os.Stderr, `Information Hub Service enables exporting and importing information. +// healthUsage displays the usage of the health command and its subcommands. +func healthUsage() { + fmt.Fprintf(os.Stderr, `Health service provides health check endpoints. Usage: - %[1]s [globalflags] infohub COMMAND [flags] + %[1]s [globalflags] health COMMAND [flags] COMMAND: - export: Export returns data signed as Verifiable Presentation. - import: Import the given data wrapped as Verifiable Presentation into the Cache. + liveness: Liveness implements Liveness. + readiness: Readiness implements Readiness. Additional help: - %[1]s infohub COMMAND --help + %[1]s health COMMAND --help `, os.Args[0]) } -func infohubExportUsage() { - fmt.Fprintf(os.Stderr, `%[1]s [flags] infohub export -export-name STRING +func healthLivenessUsage() { + fmt.Fprintf(os.Stderr, `%[1]s [flags] health liveness -Export returns data signed as Verifiable Presentation. - -export-name STRING: Name of export to be performed. +Liveness implements Liveness. Example: - %[1]s infohub export --export-name "testexport" + %[1]s health liveness `, os.Args[0]) } -func infohubImportUsage() { - fmt.Fprintf(os.Stderr, `%[1]s [flags] infohub import -body STRING +func healthReadinessUsage() { + fmt.Fprintf(os.Stderr, `%[1]s [flags] health readiness -Import the given data wrapped as Verifiable Presentation into the Cache. - -body STRING: +Readiness implements Readiness. Example: - %[1]s infohub import --body "data" + %[1]s health readiness `, os.Args[0]) } diff --git a/gen/http/health/client/encode_decode.go b/gen/http/health/client/encode_decode.go index 00da3b5a237c82366985f827428ee5458d735337..c5265be497cfef0abfa3c7cc38276958d6ff5e00 100644 --- a/gen/http/health/client/encode_decode.go +++ b/gen/http/health/client/encode_decode.go @@ -51,7 +51,20 @@ func DecodeLivenessResponse(decoder func(*http.Response) goahttp.Decoder, restor } switch resp.StatusCode { case http.StatusOK: - return nil, nil + var ( + body LivenessResponseBody + err error + ) + err = decoder(resp).Decode(&body) + if err != nil { + return nil, goahttp.ErrDecodingError("health", "Liveness", err) + } + err = ValidateLivenessResponseBody(&body) + if err != nil { + return nil, goahttp.ErrValidationError("health", "Liveness", err) + } + res := NewLivenessHealthResponseOK(&body) + return res, nil default: body, _ := io.ReadAll(resp.Body) return nil, goahttp.ErrInvalidResponse("health", "Liveness", resp.StatusCode, string(body)) @@ -93,7 +106,20 @@ func DecodeReadinessResponse(decoder func(*http.Response) goahttp.Decoder, resto } switch resp.StatusCode { case http.StatusOK: - return nil, nil + var ( + body ReadinessResponseBody + err error + ) + err = decoder(resp).Decode(&body) + if err != nil { + return nil, goahttp.ErrDecodingError("health", "Readiness", err) + } + err = ValidateReadinessResponseBody(&body) + if err != nil { + return nil, goahttp.ErrValidationError("health", "Readiness", err) + } + res := NewReadinessHealthResponseOK(&body) + return res, nil default: body, _ := io.ReadAll(resp.Body) return nil, goahttp.ErrInvalidResponse("health", "Readiness", resp.StatusCode, string(body)) diff --git a/gen/http/health/client/types.go b/gen/http/health/client/types.go index 893241d01c4e78365dada87156d786ff0c535acb..7c5cd0dcffa137328cb8933e332cebab6b991e14 100644 --- a/gen/http/health/client/types.go +++ b/gen/http/health/client/types.go @@ -6,3 +6,84 @@ // $ goa gen gitlab.eclipse.org/eclipse/xfsc/tsa/infohub/design package client + +import ( + health "gitlab.eclipse.org/eclipse/xfsc/tsa/infohub/gen/health" + goa "goa.design/goa/v3/pkg" +) + +// LivenessResponseBody is the type of the "health" service "Liveness" endpoint +// HTTP response body. +type LivenessResponseBody struct { + // Service name. + Service *string `form:"service,omitempty" json:"service,omitempty" xml:"service,omitempty"` + // Status message. + Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"` + // Service runtime version. + Version *string `form:"version,omitempty" json:"version,omitempty" xml:"version,omitempty"` +} + +// ReadinessResponseBody is the type of the "health" service "Readiness" +// endpoint HTTP response body. +type ReadinessResponseBody struct { + // Service name. + Service *string `form:"service,omitempty" json:"service,omitempty" xml:"service,omitempty"` + // Status message. + Status *string `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"` + // Service runtime version. + Version *string `form:"version,omitempty" json:"version,omitempty" xml:"version,omitempty"` +} + +// NewLivenessHealthResponseOK builds a "health" service "Liveness" endpoint +// result from a HTTP "OK" response. +func NewLivenessHealthResponseOK(body *LivenessResponseBody) *health.HealthResponse { + v := &health.HealthResponse{ + Service: *body.Service, + Status: *body.Status, + Version: *body.Version, + } + + return v +} + +// NewReadinessHealthResponseOK builds a "health" service "Readiness" endpoint +// result from a HTTP "OK" response. +func NewReadinessHealthResponseOK(body *ReadinessResponseBody) *health.HealthResponse { + v := &health.HealthResponse{ + Service: *body.Service, + Status: *body.Status, + Version: *body.Version, + } + + return v +} + +// ValidateLivenessResponseBody runs the validations defined on +// LivenessResponseBody +func ValidateLivenessResponseBody(body *LivenessResponseBody) (err error) { + if body.Service == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("service", "body")) + } + if body.Status == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("status", "body")) + } + if body.Version == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("version", "body")) + } + return +} + +// ValidateReadinessResponseBody runs the validations defined on +// ReadinessResponseBody +func ValidateReadinessResponseBody(body *ReadinessResponseBody) (err error) { + if body.Service == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("service", "body")) + } + if body.Status == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("status", "body")) + } + if body.Version == nil { + err = goa.MergeErrors(err, goa.MissingFieldError("version", "body")) + } + return +} diff --git a/gen/http/health/server/encode_decode.go b/gen/http/health/server/encode_decode.go index 81a4b7782588db5a465f4dcce56cdb7aa41ff2f3..36b7defc6c0fa931690fa3e612b5fe9bf4447e9c 100644 --- a/gen/http/health/server/encode_decode.go +++ b/gen/http/health/server/encode_decode.go @@ -11,6 +11,7 @@ import ( "context" "net/http" + health "gitlab.eclipse.org/eclipse/xfsc/tsa/infohub/gen/health" goahttp "goa.design/goa/v3/http" ) @@ -18,8 +19,11 @@ import ( // health Liveness endpoint. func EncodeLivenessResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error { return func(ctx context.Context, w http.ResponseWriter, v any) error { + res, _ := v.(*health.HealthResponse) + enc := encoder(ctx, w) + body := NewLivenessResponseBody(res) w.WriteHeader(http.StatusOK) - return nil + return enc.Encode(body) } } @@ -27,7 +31,10 @@ func EncodeLivenessResponse(encoder func(context.Context, http.ResponseWriter) g // health Readiness endpoint. func EncodeReadinessResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, any) error { return func(ctx context.Context, w http.ResponseWriter, v any) error { + res, _ := v.(*health.HealthResponse) + enc := encoder(ctx, w) + body := NewReadinessResponseBody(res) w.WriteHeader(http.StatusOK) - return nil + return enc.Encode(body) } } diff --git a/gen/http/health/server/types.go b/gen/http/health/server/types.go index 67a3d7aae73ba6466405ea6f2d5195190fa7bc8b..7b5b3b7f94385f831814654733f861e43fd78e64 100644 --- a/gen/http/health/server/types.go +++ b/gen/http/health/server/types.go @@ -6,3 +6,51 @@ // $ goa gen gitlab.eclipse.org/eclipse/xfsc/tsa/infohub/design package server + +import ( + health "gitlab.eclipse.org/eclipse/xfsc/tsa/infohub/gen/health" +) + +// LivenessResponseBody is the type of the "health" service "Liveness" endpoint +// HTTP response body. +type LivenessResponseBody struct { + // Service name. + Service string `form:"service" json:"service" xml:"service"` + // Status message. + Status string `form:"status" json:"status" xml:"status"` + // Service runtime version. + Version string `form:"version" json:"version" xml:"version"` +} + +// ReadinessResponseBody is the type of the "health" service "Readiness" +// endpoint HTTP response body. +type ReadinessResponseBody struct { + // Service name. + Service string `form:"service" json:"service" xml:"service"` + // Status message. + Status string `form:"status" json:"status" xml:"status"` + // Service runtime version. + Version string `form:"version" json:"version" xml:"version"` +} + +// NewLivenessResponseBody builds the HTTP response body from the result of the +// "Liveness" endpoint of the "health" service. +func NewLivenessResponseBody(res *health.HealthResponse) *LivenessResponseBody { + body := &LivenessResponseBody{ + Service: res.Service, + Status: res.Status, + Version: res.Version, + } + return body +} + +// NewReadinessResponseBody builds the HTTP response body from the result of +// the "Readiness" endpoint of the "health" service. +func NewReadinessResponseBody(res *health.HealthResponse) *ReadinessResponseBody { + body := &ReadinessResponseBody{ + Service: res.Service, + Status: res.Status, + Version: res.Version, + } + return body +} diff --git a/gen/http/openapi.json b/gen/http/openapi.json index 42a48004c5c9060181c4ffa79cd67bdafaf55e4e..4e66da414fd0d33707cb71267409fe9bc9f908a7 100644 --- a/gen/http/openapi.json +++ b/gen/http/openapi.json @@ -1 +1 @@ -{"swagger":"2.0","info":{"title":"Information Hub Service","description":"Information Hub Service exposes HTTP API for exporting and importing information.","version":""},"host":"localhost:8084","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/liveness":{"get":{"tags":["health"],"summary":"Liveness health","operationId":"health#Liveness","responses":{"200":{"description":"OK response."}},"schemes":["http"]}},"/readiness":{"get":{"tags":["health"],"summary":"Readiness health","operationId":"health#Readiness","responses":{"200":{"description":"OK response."}},"schemes":["http"]}},"/v1/export/{exportName}":{"get":{"tags":["infohub"],"summary":"Export infohub","description":"Export returns data signed as Verifiable Presentation.","operationId":"infohub#Export","parameters":[{"name":"exportName","in":"path","description":"Name of export to be performed.","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"string","format":"binary"}}},"schemes":["http"]}},"/v1/import":{"post":{"tags":["infohub"],"summary":"Import infohub","description":"Import the given data wrapped as Verifiable Presentation into the Cache.","operationId":"infohub#Import","parameters":[{"name":"bytes","in":"body","description":"Data wrapped in Verifiable Presentation that will be imported into Cache.","required":true,"schema":{"type":"string","format":"byte"}}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/InfohubImportResponseBody","required":["importIds"]}}},"schemes":["http"]}}},"definitions":{"InfohubImportResponseBody":{"title":"InfohubImportResponseBody","type":"object","properties":{"importIds":{"type":"array","items":{"type":"string","example":"Veniam non."},"description":"importIds is an array of unique identifiers used as Cache keys to retrieve the imported data entries later.","example":["585a999a-f36d-419d-bed3-8ebfa5bb79c9"]}},"example":{"importIds":["585a999a-f36d-419d-bed3-8ebfa5bb79c9"]},"required":["importIds"]}}} \ No newline at end of file +{"swagger":"2.0","info":{"title":"Information Hub Service","description":"Information Hub Service exposes HTTP API for exporting and importing information.","version":""},"host":"localhost:8084","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/liveness":{"get":{"tags":["health"],"summary":"Liveness health","operationId":"health#Liveness","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/HealthLivenessResponseBody","required":["service","status","version"]}}},"schemes":["http"]}},"/readiness":{"get":{"tags":["health"],"summary":"Readiness health","operationId":"health#Readiness","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/HealthReadinessResponseBody","required":["service","status","version"]}}},"schemes":["http"]}},"/v1/export/{exportName}":{"get":{"tags":["infohub"],"summary":"Export infohub","description":"Export returns data signed as Verifiable Presentation.","operationId":"infohub#Export","parameters":[{"name":"exportName","in":"path","description":"Name of export to be performed.","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"string","format":"binary"}}},"schemes":["http"]}},"/v1/import":{"post":{"tags":["infohub"],"summary":"Import infohub","description":"Import the given data wrapped as Verifiable Presentation into the Cache.","operationId":"infohub#Import","parameters":[{"name":"bytes","in":"body","description":"Data wrapped in Verifiable Presentation that will be imported into Cache.","required":true,"schema":{"type":"string","format":"byte"}}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/InfohubImportResponseBody","required":["importIds"]}}},"schemes":["http"]}}},"definitions":{"HealthLivenessResponseBody":{"title":"HealthLivenessResponseBody","type":"object","properties":{"service":{"type":"string","description":"Service name.","example":"Atque voluptatem."},"status":{"type":"string","description":"Status message.","example":"Optio et enim in eum."},"version":{"type":"string","description":"Service runtime version.","example":"A consequatur iusto."}},"example":{"service":"Vel voluptates.","status":"Ut quidem.","version":"Iusto reprehenderit praesentium sint est molestiae labore."},"required":["service","status","version"]},"HealthReadinessResponseBody":{"title":"HealthReadinessResponseBody","type":"object","properties":{"service":{"type":"string","description":"Service name.","example":"Placeat quia qui tenetur."},"status":{"type":"string","description":"Status message.","example":"Est adipisci incidunt."},"version":{"type":"string","description":"Service runtime version.","example":"Ipsa cum expedita dolore."}},"example":{"service":"Excepturi iusto.","status":"Ut quo quae.","version":"Qui consequatur laborum et dolorem."},"required":["service","status","version"]},"InfohubImportResponseBody":{"title":"InfohubImportResponseBody","type":"object","properties":{"importIds":{"type":"array","items":{"type":"string","example":"Rerum possimus dolor fugiat fugit."},"description":"importIds is an array of unique identifiers used as Cache keys to retrieve the imported data entries later.","example":["585a999a-f36d-419d-bed3-8ebfa5bb79c9"]}},"example":{"importIds":["585a999a-f36d-419d-bed3-8ebfa5bb79c9"]},"required":["importIds"]}}} \ No newline at end of file diff --git a/gen/http/openapi.yaml b/gen/http/openapi.yaml index d97b75e1656bcbcebfe7f2ec1ae8ee24b2ab8365..bb0ddac4b0769017b6680ecac1d96a537913f820 100644 --- a/gen/http/openapi.yaml +++ b/gen/http/openapi.yaml @@ -22,6 +22,12 @@ paths: responses: "200": description: OK response. + schema: + $ref: '#/definitions/HealthLivenessResponseBody' + required: + - service + - status + - version schemes: - http /readiness: @@ -33,6 +39,12 @@ paths: responses: "200": description: OK response. + schema: + $ref: '#/definitions/HealthReadinessResponseBody' + required: + - service + - status + - version schemes: - http /v1/export/{exportName}: @@ -81,6 +93,54 @@ paths: schemes: - http definitions: + HealthLivenessResponseBody: + title: HealthLivenessResponseBody + type: object + properties: + service: + type: string + description: Service name. + example: Atque voluptatem. + status: + type: string + description: Status message. + example: Optio et enim in eum. + version: + type: string + description: Service runtime version. + example: A consequatur iusto. + example: + service: Vel voluptates. + status: Ut quidem. + version: Iusto reprehenderit praesentium sint est molestiae labore. + required: + - service + - status + - version + HealthReadinessResponseBody: + title: HealthReadinessResponseBody + type: object + properties: + service: + type: string + description: Service name. + example: Placeat quia qui tenetur. + status: + type: string + description: Status message. + example: Est adipisci incidunt. + version: + type: string + description: Service runtime version. + example: Ipsa cum expedita dolore. + example: + service: Excepturi iusto. + status: Ut quo quae. + version: Qui consequatur laborum et dolorem. + required: + - service + - status + - version InfohubImportResponseBody: title: InfohubImportResponseBody type: object @@ -89,7 +149,7 @@ definitions: type: array items: type: string - example: Veniam non. + example: Rerum possimus dolor fugiat fugit. description: importIds is an array of unique identifiers used as Cache keys to retrieve the imported data entries later. example: - 585a999a-f36d-419d-bed3-8ebfa5bb79c9 diff --git a/gen/http/openapi3.json b/gen/http/openapi3.json index e121b07cd358bb8a74fded3de2062adb554b48bc..6b7a04cc10c6a72194f547124f294802e622c32c 100644 --- a/gen/http/openapi3.json +++ b/gen/http/openapi3.json @@ -1 +1 @@ -{"openapi":"3.0.3","info":{"title":"Information Hub Service","description":"Information Hub Service exposes HTTP API for exporting and importing information.","version":"1.0"},"servers":[{"url":"http://localhost:8084","description":"Information Hub Server"}],"paths":{"/liveness":{"get":{"tags":["health"],"summary":"Liveness health","operationId":"health#Liveness","responses":{"200":{"description":"OK response."}}}},"/readiness":{"get":{"tags":["health"],"summary":"Readiness health","operationId":"health#Readiness","responses":{"200":{"description":"OK response."}}}},"/v1/export/{exportName}":{"get":{"tags":["infohub"],"summary":"Export infohub","description":"Export returns data signed as Verifiable Presentation.","operationId":"infohub#Export","parameters":[{"name":"exportName","in":"path","description":"Name of export to be performed.","required":true,"schema":{"type":"string","description":"Name of export to be performed.","example":"testexport"},"example":"testexport"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","example":"Ipsam similique nulla quis.","format":"binary"},"example":"Hic iste totam."}}}}}},"/v1/import":{"post":{"tags":["infohub"],"summary":"Import infohub","description":"Import the given data wrapped as Verifiable Presentation into the Cache.","operationId":"infohub#Import","requestBody":{"description":"Data wrapped in Verifiable Presentation that will be imported into Cache.","required":true,"content":{"application/json":{"schema":{"type":"string","description":"Data wrapped in Verifiable Presentation that will be imported into Cache.","example":"data","format":"binary"},"example":"data"}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportResult"},"example":{"importIds":["585a999a-f36d-419d-bed3-8ebfa5bb79c9"]}}}}}}}},"components":{"schemas":{"ImportResult":{"type":"object","properties":{"importIds":{"type":"array","items":{"type":"string","example":"Quibusdam ut exercitationem dolore eius id sed."},"description":"importIds is an array of unique identifiers used as Cache keys to retrieve the imported data entries later.","example":["585a999a-f36d-419d-bed3-8ebfa5bb79c9"]}},"example":{"importIds":["585a999a-f36d-419d-bed3-8ebfa5bb79c9"]},"required":["importIds"]}}},"tags":[{"name":"health","description":"Health service provides health check endpoints."},{"name":"infohub","description":"Information Hub Service enables exporting and importing information."}]} \ No newline at end of file +{"openapi":"3.0.3","info":{"title":"Information Hub Service","description":"Information Hub Service exposes HTTP API for exporting and importing information.","version":"1.0"},"servers":[{"url":"http://localhost:8084","description":"Information Hub Server"}],"paths":{"/liveness":{"get":{"tags":["health"],"summary":"Liveness health","operationId":"health#Liveness","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"},"example":{"service":"Hic iste totam.","status":"Et eos hic similique.","version":"Ut eos magnam in itaque quia."}}}}}}},"/readiness":{"get":{"tags":["health"],"summary":"Readiness health","operationId":"health#Readiness","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"},"example":{"service":"Voluptatem labore omnis.","status":"Qui reiciendis doloremque magni dicta rerum.","version":"Autem sed molestiae quibusdam velit."}}}}}}},"/v1/export/{exportName}":{"get":{"tags":["infohub"],"summary":"Export infohub","description":"Export returns data signed as Verifiable Presentation.","operationId":"infohub#Export","parameters":[{"name":"exportName","in":"path","description":"Name of export to be performed.","required":true,"schema":{"type":"string","description":"Name of export to be performed.","example":"testexport"},"example":"testexport"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","example":"Quis repudiandae neque sed.","format":"binary"},"example":"Praesentium quo esse voluptatem sapiente."}}}}}},"/v1/import":{"post":{"tags":["infohub"],"summary":"Import infohub","description":"Import the given data wrapped as Verifiable Presentation into the Cache.","operationId":"infohub#Import","requestBody":{"description":"Data wrapped in Verifiable Presentation that will be imported into Cache.","required":true,"content":{"application/json":{"schema":{"type":"string","description":"Data wrapped in Verifiable Presentation that will be imported into Cache.","example":"data","format":"binary"},"example":"data"}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportResult"},"example":{"importIds":["585a999a-f36d-419d-bed3-8ebfa5bb79c9"]}}}}}}}},"components":{"schemas":{"HealthResponse":{"type":"object","properties":{"service":{"type":"string","description":"Service name.","example":"Minima qui ducimus earum et."},"status":{"type":"string","description":"Status message.","example":"Provident eaque deserunt."},"version":{"type":"string","description":"Service runtime version.","example":"Voluptatem quo."}},"example":{"service":"Iure beatae asperiores accusantium ex id quisquam.","status":"Ut non.","version":"Et sed quia ut."},"required":["service","status","version"]},"ImportResult":{"type":"object","properties":{"importIds":{"type":"array","items":{"type":"string","example":"Voluptas voluptates numquam et velit."},"description":"importIds is an array of unique identifiers used as Cache keys to retrieve the imported data entries later.","example":["585a999a-f36d-419d-bed3-8ebfa5bb79c9"]}},"example":{"importIds":["585a999a-f36d-419d-bed3-8ebfa5bb79c9"]},"required":["importIds"]}}},"tags":[{"name":"infohub","description":"Information Hub Service enables exporting and importing information."},{"name":"health","description":"Health service provides health check endpoints."}]} \ No newline at end of file diff --git a/gen/http/openapi3.yaml b/gen/http/openapi3.yaml index bc9348f1cf7118b48525eb38f4c3a7c5eae1b32d..a342ed4019f8962d5a7f232a933c6be57e5fd5fa 100644 --- a/gen/http/openapi3.yaml +++ b/gen/http/openapi3.yaml @@ -16,6 +16,14 @@ paths: responses: "200": description: OK response. + content: + application/json: + schema: + $ref: '#/components/schemas/HealthResponse' + example: + service: Hic iste totam. + status: Et eos hic similique. + version: Ut eos magnam in itaque quia. /readiness: get: tags: @@ -25,6 +33,14 @@ paths: responses: "200": description: OK response. + content: + application/json: + schema: + $ref: '#/components/schemas/HealthResponse' + example: + service: Voluptatem labore omnis. + status: Qui reiciendis doloremque magni dicta rerum. + version: Autem sed molestiae quibusdam velit. /v1/export/{exportName}: get: tags: @@ -49,9 +65,9 @@ paths: application/json: schema: type: string - example: Ipsam similique nulla quis. + example: Quis repudiandae neque sed. format: binary - example: Hic iste totam. + example: Praesentium quo esse voluptatem sapiente. /v1/import: post: tags: @@ -82,6 +98,29 @@ paths: - 585a999a-f36d-419d-bed3-8ebfa5bb79c9 components: schemas: + HealthResponse: + type: object + properties: + service: + type: string + description: Service name. + example: Minima qui ducimus earum et. + status: + type: string + description: Status message. + example: Provident eaque deserunt. + version: + type: string + description: Service runtime version. + example: Voluptatem quo. + example: + service: Iure beatae asperiores accusantium ex id quisquam. + status: Ut non. + version: Et sed quia ut. + required: + - service + - status + - version ImportResult: type: object properties: @@ -89,7 +128,7 @@ components: type: array items: type: string - example: Quibusdam ut exercitationem dolore eius id sed. + example: Voluptas voluptates numquam et velit. description: importIds is an array of unique identifiers used as Cache keys to retrieve the imported data entries later. example: - 585a999a-f36d-419d-bed3-8ebfa5bb79c9 @@ -99,7 +138,7 @@ components: required: - importIds tags: - - name: health - description: Health service provides health check endpoints. - name: infohub description: Information Hub Service enables exporting and importing information. + - name: health + description: Health service provides health check endpoints. diff --git a/go.mod b/go.mod index 63b4a7762ca3e890cb71c041f27fef143e563261..0d5392e6086171568093f45ec8e7ff88a53019ef 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module gitlab.eclipse.org/eclipse/xfsc/tsa/infohub -go 1.20 +go 1.21 require ( github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 diff --git a/go.sum b/go.sum index 6cb0d677a5878991d8e5b49b4e1489524981c7b2..d509b9607b89bfe94d1999d3fb59a0e7db99e9e7 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,14 @@ github.com/PaesslerAG/gval v1.1.0 h1:k3RuxeZDO3eejD4cMPSt+74tUSvTnbGvLx0df4mdwFc= +github.com/PaesslerAG/gval v1.1.0/go.mod h1:y/nm5yEyTeX6av0OfKJNp9rBNj2XrGhAf5+v24IBN1I= github.com/PaesslerAG/jsonpath v0.1.1 h1:c1/AToHQMVsduPAa4Vh6xp2U0evy4t8SWp8imEsylIk= +github.com/PaesslerAG/jsonpath v0.1.1/go.mod h1:lVboNxFGal/VwW6d9JzIy56bUsYAP6tH/x80vjnCseY= github.com/VictoriaMetrics/fastcache v1.5.7 h1:4y6y0G8PRzszQUYIQHHssv/jgPHAb5qQuuDNdCbyAgw= github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= @@ -55,7 +58,9 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gxui v0.0.0-20151028112939-f85e0a97b3a4 h1:OL2d27ueTKnlQJoqLW2fc9pWYulFnJYLWzomGV7HqZo= +github.com/google/gxui v0.0.0-20151028112939-f85e0a97b3a4/go.mod h1:Pw1H1OjSNHiqeuxAduB1BKYXIwFtsyrY47nEqSgEiCM= github.com/google/tink/go v1.7.0 h1:6Eox8zONGebBFcCBqkVmt60LaWZa6xg1cl/DwAh/J1w= github.com/google/tink/go v1.7.0/go.mod h1:GAUOd+QE3pgj9q8VKIGTCP33c/B7eb4NhxLcgTJZStM= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -74,6 +79,7 @@ github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230501135648-a9a7ad029347 h1:oPGUCpmnm7yxsVllcMQnHF3uc3hy4jfrSCh7nvzXA00= github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230501135648-a9a7ad029347/go.mod h1:nF8fHsYY+GZl74AFAQaKAhYWOOSaLVzW/TZ0Sq/6axI= github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3 h1:JGYA9l5zTlvsvfnXT9hYPpCokAjmVKX0/r7njba7OX4= +github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3/go.mod h1:aSG2dWjYVzu2PVBtOqsYghaChA5+UUXnBbL+MfVceYQ= github.com/hyperledger/aries-framework-go/spi v0.0.0-20230427134832-0c9969493bd3 h1:ytWmOQZIYQfVJ4msFvrqlp6d+ZLhT43wS8rgE2m+J1A= github.com/hyperledger/aries-framework-go/spi v0.0.0-20230427134832-0c9969493bd3/go.mod h1:oryUyWb23l/a3tAP9KW+GBbfcfqp9tZD4y5hSkFrkqI= github.com/hyperledger/ursa-wrapper-go v0.3.1 h1:Do+QrVNniY77YK2jTIcyWqj9rm/Yb5SScN0bqCjiibA= @@ -81,6 +87,7 @@ github.com/hyperledger/ursa-wrapper-go v0.3.1/go.mod h1:nPSAuMasIzSVciQo22PedBk4 github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a h1:zPPuIq2jAWWPTrGt70eK/BSch+gFAGrNzecsoENgu2o= +github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= @@ -93,9 +100,11 @@ github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQ github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80= github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= @@ -112,10 +121,13 @@ github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmt github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ= github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d/go.mod h1:WZy8Q5coAB1zhY9AOBJP0O6J4BuDfbupUDavKY+I3+s= github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b h1:3E44bLeN8uKYdfQqVQycPnaVviZdBLbizFhU49mtbe4= +github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b/go.mod h1:Bj8LjjP0ReT1eKt5QlKjwgi5AFm5mI6O1A2G4ChI0Ag= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= +github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0= @@ -129,7 +141,9 @@ github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoR github.com/multiformats/go-multibase v0.1.1 h1:3ASCDsuLX8+j4kx58qnJ4YFq/JWTJpCyDW27ztsVTOI= github.com/multiformats/go-multibase v0.1.1/go.mod h1:ZEjHE+IsUrgp5mhlEAYjMtZwK1k4haNkcaPg9aoe1a8= github.com/multiformats/go-multihash v0.0.13 h1:06x+mk/zj1FoMsgNejLpy6QTvJqlSt/BhLEy87zidlc= +github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-varint v0.0.5 h1:XVZwSo04Cs3j/jS0uAEPpT3JY6DzMcVLLoWOSnCxOjg= +github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= @@ -159,7 +173,9 @@ github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NF github.com/smartystreets/assertions v1.13.0 h1:Dx1kYM01xsSqKPno3aqLnrwac2LetPvN23diwyr69Qs= github.com/smartystreets/assertions v1.13.0/go.mod h1:wDmR7qL282YbGsPy6H/yAsesrxfxaaSlJazyFLYVFx8= github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= +github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -195,6 +211,7 @@ gitlab.eclipse.org/eclipse/xfsc/tsa/golib v1.3.2-0.20230810143053-d53786b08923/g go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE= go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= @@ -282,6 +299,7 @@ google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/credential/credentials.go b/internal/credential/credentials.go index f1e9121d01f79e500f8f99c0a331fdca76843d12..fdd2ffcf85fbf1306aab8cc061d1e740b95f0460 100644 --- a/internal/credential/credentials.go +++ b/internal/credential/credentials.go @@ -32,7 +32,7 @@ func New(issuerURI string, httpClient *http.Client) *Credentials { } // NewCredential creates a Verifiable Credential without proofs. -func (c *Credentials) NewCredential(contexts []string, subjectID string, subject map[string]interface{}, proof bool) (*verifiable.Credential, error) { +func (c *Credentials) NewCredential(contexts []string, subjectID string, subject map[string]interface{}, proof bool) (*verifiable.Credential, error) { //nolint:revive jsonldContexts := defaultContexts jsonldContexts = append(jsonldContexts, contexts...) diff --git a/internal/service/error_response.go b/internal/service/error_response.go index c079923a83800c8d4bc050a07fc929e5c83b2a80..9234f3041e4f396e936b553b74492589d15728e0 100644 --- a/internal/service/error_response.go +++ b/internal/service/error_response.go @@ -2,6 +2,7 @@ package service import ( "context" + goahttp "goa.design/goa/v3/http" goa "goa.design/goa/v3/pkg" diff --git a/internal/service/health/service.go b/internal/service/health/service.go index ffa6d9af3d67b8681ce5464bc555ca38aa6b801e..7f553918a004831dbf22191299d680bdf33ce639 100644 --- a/internal/service/health/service.go +++ b/internal/service/health/service.go @@ -1,17 +1,31 @@ package health -import "context" +import ( + "context" -type Service struct{} + "gitlab.eclipse.org/eclipse/xfsc/tsa/infohub/gen/health" +) -func New() *Service { - return &Service{} +type Service struct { + version string } -func (s *Service) Liveness(ctx context.Context) error { - return nil +func New(version string) *Service { + return &Service{version: version} } -func (s *Service) Readiness(ctx context.Context) error { - return nil +func (s *Service) Liveness(_ context.Context) (*health.HealthResponse, error) { + return &health.HealthResponse{ + Service: "infohub", + Status: "up", + Version: s.version, + }, nil +} + +func (s *Service) Readiness(_ context.Context) (*health.HealthResponse, error) { + return &health.HealthResponse{ + Service: "infohub", + Status: "up", + Version: s.version, + }, nil }