Skip to content
Snippets Groups Projects
Commit cae0df38 authored by Lyuben Penkovski's avatar Lyuben Penkovski
Browse files

Merge branch 'health-check-service-version' into 'main'

Add service version to healtcheck responses

See merge request eclipse/xfsc/tsa/infohub!11
parents d4caff85 8785f8dd
No related branches found
No related tags found
No related merge requests found
Showing
with 394 additions and 167 deletions
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
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
......@@ -107,7 +107,7 @@ func main() {
)
{
infohubSvc = infohub.New(storage, policy, cache, credentials, signer, logger)
healthSvc = health.New()
healthSvc = health.New(Version)
}
// create endpoints
......
FROM golang:1.20.5-alpine3.17 as builder
FROM golang:1.21.3-alpine3.17 as builder
RUN apk add git
......
FROM golang:1.20.5
FROM golang:1.21.3
ENV GO111MODULE=on
......
......@@ -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)
......
......@@ -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")
})
......@@ -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
}
......@@ -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)
}
}
......@@ -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
}
......@@ -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])
}
......@@ -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))
......
......@@ -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
}
......@@ -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)
}
}
......@@ -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
}
{"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
......@@ -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
......
{"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
......@@ -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.
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment