diff --git a/gen/cache/service.go b/gen/cache/service.go index 1713fd675f2b243aa0f0b60dd9bc7077713af63b..647438abf35fe63f75e8a789c287a207d849f4e9 100644 --- a/gen/cache/service.go +++ b/gen/cache/service.go @@ -45,4 +45,5 @@ type CacheSetRequest struct { Key string Namespace *string Scope *string + TTL *int } diff --git a/gen/http/cache/client/cli.go b/gen/http/cache/client/cli.go index b9f2a52ca1bb09c6e43815a548b802b1a3a65314..d3bf62ac67d80a43c413a7e38eeed5295434035c 100644 --- a/gen/http/cache/client/cli.go +++ b/gen/http/cache/client/cli.go @@ -11,6 +11,7 @@ package client import ( "encoding/json" "fmt" + "strconv" cache "gitlab.com/gaia-x/data-infrastructure-federation-services/tsa/cache/gen/cache" ) @@ -42,13 +43,13 @@ func BuildGetPayload(cacheGetKey string, cacheGetNamespace string, cacheGetScope } // BuildSetPayload builds the payload for the cache Set endpoint from CLI flags. -func BuildSetPayload(cacheSetBody string, cacheSetKey string, cacheSetNamespace string, cacheSetScope string) (*cache.CacheSetRequest, error) { +func BuildSetPayload(cacheSetBody string, cacheSetKey string, cacheSetNamespace string, cacheSetScope string, cacheSetTTL string) (*cache.CacheSetRequest, error) { var err error var body interface{} { err = json.Unmarshal([]byte(cacheSetBody), &body) if err != nil { - return nil, fmt.Errorf("invalid JSON for body, \nerror: %s, \nexample of valid JSON:\n%s", err, "\"Quasi ut.\"") + return nil, fmt.Errorf("invalid JSON for body, \nerror: %s, \nexample of valid JSON:\n%s", err, "\"Corporis omnis itaque earum quasi.\"") } } var key string @@ -67,6 +68,18 @@ func BuildSetPayload(cacheSetBody string, cacheSetKey string, cacheSetNamespace scope = &cacheSetScope } } + var ttl *int + { + if cacheSetTTL != "" { + var v int64 + v, err = strconv.ParseInt(cacheSetTTL, 10, strconv.IntSize) + val := int(v) + ttl = &val + if err != nil { + return nil, fmt.Errorf("invalid value for ttl, must be INT") + } + } + } v := body res := &cache.CacheSetRequest{ Data: v, @@ -74,13 +87,14 @@ func BuildSetPayload(cacheSetBody string, cacheSetKey string, cacheSetNamespace res.Key = key res.Namespace = namespace res.Scope = scope + res.TTL = ttl return res, nil } // BuildSetExternalPayload builds the payload for the cache SetExternal // endpoint from CLI flags. -func BuildSetExternalPayload(cacheSetExternalBody string, cacheSetExternalKey string, cacheSetExternalNamespace string, cacheSetExternalScope string) (*cache.CacheSetRequest, error) { +func BuildSetExternalPayload(cacheSetExternalBody string, cacheSetExternalKey string, cacheSetExternalNamespace string, cacheSetExternalScope string, cacheSetExternalTTL string) (*cache.CacheSetRequest, error) { var err error var body interface{} { @@ -105,6 +119,18 @@ func BuildSetExternalPayload(cacheSetExternalBody string, cacheSetExternalKey st scope = &cacheSetExternalScope } } + var ttl *int + { + if cacheSetExternalTTL != "" { + var v int64 + v, err = strconv.ParseInt(cacheSetExternalTTL, 10, strconv.IntSize) + val := int(v) + ttl = &val + if err != nil { + return nil, fmt.Errorf("invalid value for ttl, must be INT") + } + } + } v := body res := &cache.CacheSetRequest{ Data: v, @@ -112,6 +138,7 @@ func BuildSetExternalPayload(cacheSetExternalBody string, cacheSetExternalKey st res.Key = key res.Namespace = namespace res.Scope = scope + res.TTL = ttl return res, nil } diff --git a/gen/http/cache/client/encode_decode.go b/gen/http/cache/client/encode_decode.go index f84efd8d321b510681f3118a05f6d7ea646c3e20..a23df0e81b504323fdc045cbbfa3548b3e5a8efa 100644 --- a/gen/http/cache/client/encode_decode.go +++ b/gen/http/cache/client/encode_decode.go @@ -14,6 +14,7 @@ import ( "io" "net/http" "net/url" + "strconv" cache "gitlab.com/gaia-x/data-infrastructure-federation-services/tsa/cache/gen/cache" goahttp "goa.design/goa/v3/http" @@ -128,6 +129,11 @@ func EncodeSetRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Re head := *p.Scope req.Header.Set("x-cache-scope", head) } + if p.TTL != nil { + head := *p.TTL + headStr := strconv.Itoa(head) + req.Header.Set("x-cache-ttl", headStr) + } body := p.Data if err := encoder(req).Encode(&body); err != nil { return goahttp.ErrEncodingError("cache", "Set", err) @@ -198,6 +204,11 @@ func EncodeSetExternalRequest(encoder func(*http.Request) goahttp.Encoder) func( head := *p.Scope req.Header.Set("x-cache-scope", head) } + if p.TTL != nil { + head := *p.TTL + headStr := strconv.Itoa(head) + req.Header.Set("x-cache-ttl", headStr) + } body := p.Data if err := encoder(req).Encode(&body); err != nil { return goahttp.ErrEncodingError("cache", "SetExternal", err) diff --git a/gen/http/cache/server/encode_decode.go b/gen/http/cache/server/encode_decode.go index 3881e6a016e42c0dd1d0e183b63f25a18c3f23c7..8bdd85d97200325fbbac664aa8ccf0b9af33a551 100644 --- a/gen/http/cache/server/encode_decode.go +++ b/gen/http/cache/server/encode_decode.go @@ -12,6 +12,7 @@ import ( "context" "io" "net/http" + "strconv" goahttp "goa.design/goa/v3/http" goa "goa.design/goa/v3/pkg" @@ -90,6 +91,7 @@ func DecodeSetRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Dec key string namespace *string scope *string + ttl *int ) key = r.Header.Get("x-cache-key") if key == "" { @@ -103,10 +105,21 @@ func DecodeSetRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Dec if scopeRaw != "" { scope = &scopeRaw } + { + ttlRaw := r.Header.Get("x-cache-ttl") + if ttlRaw != "" { + v, err2 := strconv.ParseInt(ttlRaw, 10, strconv.IntSize) + if err2 != nil { + err = goa.MergeErrors(err, goa.InvalidFieldTypeError("ttl", ttlRaw, "integer")) + } + pv := int(v) + ttl = &pv + } + } if err != nil { return nil, err } - payload := NewSetCacheSetRequest(body, key, namespace, scope) + payload := NewSetCacheSetRequest(body, key, namespace, scope, ttl) return payload, nil } @@ -141,6 +154,7 @@ func DecodeSetExternalRequest(mux goahttp.Muxer, decoder func(*http.Request) goa key string namespace *string scope *string + ttl *int ) key = r.Header.Get("x-cache-key") if key == "" { @@ -154,10 +168,21 @@ func DecodeSetExternalRequest(mux goahttp.Muxer, decoder func(*http.Request) goa if scopeRaw != "" { scope = &scopeRaw } + { + ttlRaw := r.Header.Get("x-cache-ttl") + if ttlRaw != "" { + v, err2 := strconv.ParseInt(ttlRaw, 10, strconv.IntSize) + if err2 != nil { + err = goa.MergeErrors(err, goa.InvalidFieldTypeError("ttl", ttlRaw, "integer")) + } + pv := int(v) + ttl = &pv + } + } if err != nil { return nil, err } - payload := NewSetExternalCacheSetRequest(body, key, namespace, scope) + payload := NewSetExternalCacheSetRequest(body, key, namespace, scope, ttl) return payload, nil } diff --git a/gen/http/cache/server/types.go b/gen/http/cache/server/types.go index 4ba57fe4fbf64f7b4ee535721167d8085c2768f8..5d3ee38b4e8cbf472844c84b7a3a1e9b2359d156 100644 --- a/gen/http/cache/server/types.go +++ b/gen/http/cache/server/types.go @@ -23,7 +23,7 @@ func NewGetCacheGetRequest(key string, namespace *string, scope *string) *cache. } // NewSetCacheSetRequest builds a cache service Set endpoint payload. -func NewSetCacheSetRequest(body interface{}, key string, namespace *string, scope *string) *cache.CacheSetRequest { +func NewSetCacheSetRequest(body interface{}, key string, namespace *string, scope *string, ttl *int) *cache.CacheSetRequest { v := body res := &cache.CacheSetRequest{ Data: v, @@ -31,13 +31,14 @@ func NewSetCacheSetRequest(body interface{}, key string, namespace *string, scop res.Key = key res.Namespace = namespace res.Scope = scope + res.TTL = ttl return res } // NewSetExternalCacheSetRequest builds a cache service SetExternal endpoint // payload. -func NewSetExternalCacheSetRequest(body interface{}, key string, namespace *string, scope *string) *cache.CacheSetRequest { +func NewSetExternalCacheSetRequest(body interface{}, key string, namespace *string, scope *string, ttl *int) *cache.CacheSetRequest { v := body res := &cache.CacheSetRequest{ Data: v, @@ -45,6 +46,7 @@ func NewSetExternalCacheSetRequest(body interface{}, key string, namespace *stri res.Key = key res.Namespace = namespace res.Scope = scope + res.TTL = ttl return res } diff --git a/gen/http/cli/cache/cli.go b/gen/http/cli/cache/cli.go index 677da6471d8fb9c360e91dadf436d3ca4f8c4aa7..de57fabedfbbc216b24f74f845a4ace6362e7122 100644 --- a/gen/http/cli/cache/cli.go +++ b/gen/http/cli/cache/cli.go @@ -32,7 +32,7 @@ cache (get|set|set-external) // 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] + ` cache get --key "Suscipit sed consequatur rerum occaecati in veritatis." --namespace "Repudiandae eos consequatur sint dolorum occaecati." --scope "Voluptatum modi tenetur tempore quia est ratione."` + "\n" + + os.Args[0] + ` cache get --key "Sed consequatur rerum occaecati." --namespace "Veritatis exercitationem repudiandae eos." --scope "Sint dolorum occaecati."` + "\n" + "" } @@ -64,12 +64,14 @@ func ParseEndpoint( cacheSetKeyFlag = cacheSetFlags.String("key", "REQUIRED", "") cacheSetNamespaceFlag = cacheSetFlags.String("namespace", "", "") cacheSetScopeFlag = cacheSetFlags.String("scope", "", "") + cacheSetTTLFlag = cacheSetFlags.String("ttl", "", "") cacheSetExternalFlags = flag.NewFlagSet("set-external", flag.ExitOnError) cacheSetExternalBodyFlag = cacheSetExternalFlags.String("body", "REQUIRED", "") cacheSetExternalKeyFlag = cacheSetExternalFlags.String("key", "REQUIRED", "") cacheSetExternalNamespaceFlag = cacheSetExternalFlags.String("namespace", "", "") cacheSetExternalScopeFlag = cacheSetExternalFlags.String("scope", "", "") + cacheSetExternalTTLFlag = cacheSetExternalFlags.String("ttl", "", "") ) healthFlags.Usage = healthUsage healthLivenessFlags.Usage = healthLivenessUsage @@ -175,10 +177,10 @@ func ParseEndpoint( data, err = cachec.BuildGetPayload(*cacheGetKeyFlag, *cacheGetNamespaceFlag, *cacheGetScopeFlag) case "set": endpoint = c.Set() - data, err = cachec.BuildSetPayload(*cacheSetBodyFlag, *cacheSetKeyFlag, *cacheSetNamespaceFlag, *cacheSetScopeFlag) + data, err = cachec.BuildSetPayload(*cacheSetBodyFlag, *cacheSetKeyFlag, *cacheSetNamespaceFlag, *cacheSetScopeFlag, *cacheSetTTLFlag) case "set-external": endpoint = c.SetExternal() - data, err = cachec.BuildSetExternalPayload(*cacheSetExternalBodyFlag, *cacheSetExternalKeyFlag, *cacheSetExternalNamespaceFlag, *cacheSetExternalScopeFlag) + data, err = cachec.BuildSetExternalPayload(*cacheSetExternalBodyFlag, *cacheSetExternalKeyFlag, *cacheSetExternalNamespaceFlag, *cacheSetExternalScopeFlag, *cacheSetExternalTTLFlag) } } } @@ -247,34 +249,36 @@ Get JSON value from the cache. -scope STRING: Example: - %[1]s cache get --key "Suscipit sed consequatur rerum occaecati in veritatis." --namespace "Repudiandae eos consequatur sint dolorum occaecati." --scope "Voluptatum modi tenetur tempore quia est ratione." + %[1]s cache get --key "Sed consequatur rerum occaecati." --namespace "Veritatis exercitationem repudiandae eos." --scope "Sint dolorum occaecati." `, os.Args[0]) } func cacheSetUsage() { - fmt.Fprintf(os.Stderr, `%[1]s [flags] cache set -body JSON -key STRING -namespace STRING -scope STRING + fmt.Fprintf(os.Stderr, `%[1]s [flags] cache set -body JSON -key STRING -namespace STRING -scope STRING -ttl INT Set a JSON value in the cache. -body JSON: -key STRING: -namespace STRING: -scope STRING: + -ttl INT: Example: - %[1]s cache set --body "Quasi ut." --key "Quasi perspiciatis." --namespace "Accusantium animi non alias." --scope "Esse inventore ullam placeat aut." + %[1]s cache set --body "Corporis omnis itaque earum quasi." --key "Et eligendi nihil optio natus assumenda." --namespace "Quasi perspiciatis." --scope "Accusantium animi non alias." --ttl 3495630911155968941 `, os.Args[0]) } func cacheSetExternalUsage() { - fmt.Fprintf(os.Stderr, `%[1]s [flags] cache set-external -body JSON -key STRING -namespace STRING -scope STRING + fmt.Fprintf(os.Stderr, `%[1]s [flags] cache set-external -body JSON -key STRING -namespace STRING -scope STRING -ttl INT Set an external JSON value in the cache and provide an event for the input. -body JSON: -key STRING: -namespace STRING: -scope STRING: + -ttl INT: Example: - %[1]s cache set-external --body "Enim vel." --key "Quisquam ab dolores distinctio quis." --namespace "Optio aliquam error nam." --scope "Recusandae illo." + %[1]s cache set-external --body "Enim vel." --key "Ut in." --namespace "Ab dolores distinctio quis." --scope "Optio aliquam error nam." --ttl 2227603043401673122 `, os.Args[0]) } diff --git a/gen/http/openapi.json b/gen/http/openapi.json index 09b30f74eef160ebfc93377244c4a4019f86c262..db6dba5cfe04622d911f3e0751f9cc4b850e9974 100644 --- a/gen/http/openapi.json +++ b/gen/http/openapi.json @@ -1 +1 @@ -{"swagger":"2.0","info":{"title":"Cache Service","description":"The cache service exposes interface for working with Redis.","version":""},"host":"localhost:8083","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/cache":{"get":{"tags":["cache"],"summary":"Get cache","description":"Get JSON value from the cache.","operationId":"cache#Get","produces":["application/json"],"parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","required":true,"type":"string"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","required":false,"type":"string"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","required":false,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"string","format":"binary"}}},"schemes":["http"]},"post":{"tags":["cache"],"summary":"Set cache","description":"Set a JSON value in the cache.","operationId":"cache#Set","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","required":true,"type":"string"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","required":false,"type":"string"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","required":false,"type":"string"},{"name":"any","in":"body","required":true,"schema":{"type":"string","format":"binary"}}],"responses":{"201":{"description":"Created response."}},"schemes":["http"]}},"/v1/external/cache":{"post":{"tags":["cache"],"summary":"SetExternal cache","description":"Set an external JSON value in the cache and provide an event for the input.","operationId":"cache#SetExternal","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","required":true,"type":"string"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","required":false,"type":"string"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","required":false,"type":"string"},{"name":"any","in":"body","required":true,"schema":{"type":"string","format":"binary"}}],"responses":{"200":{"description":"OK response."}},"schemes":["http"]}}}} \ No newline at end of file +{"swagger":"2.0","info":{"title":"Cache Service","description":"The cache service exposes interface for working with Redis.","version":""},"host":"localhost:8083","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/cache":{"get":{"tags":["cache"],"summary":"Get cache","description":"Get JSON value from the cache.","operationId":"cache#Get","produces":["application/json"],"parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","required":true,"type":"string"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","required":false,"type":"string"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","required":false,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"string","format":"binary"}}},"schemes":["http"]},"post":{"tags":["cache"],"summary":"Set cache","description":"Set a JSON value in the cache.","operationId":"cache#Set","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","required":true,"type":"string"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","required":false,"type":"string"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","required":false,"type":"string"},{"name":"x-cache-ttl","in":"header","description":"Cache entry TTL in seconds","required":false,"type":"integer"},{"name":"any","in":"body","required":true,"schema":{"type":"string","format":"binary"}}],"responses":{"201":{"description":"Created response."}},"schemes":["http"]}},"/v1/external/cache":{"post":{"tags":["cache"],"summary":"SetExternal cache","description":"Set an external JSON value in the cache and provide an event for the input.","operationId":"cache#SetExternal","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","required":true,"type":"string"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","required":false,"type":"string"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","required":false,"type":"string"},{"name":"x-cache-ttl","in":"header","description":"Cache entry TTL in seconds","required":false,"type":"integer"},{"name":"any","in":"body","required":true,"schema":{"type":"string","format":"binary"}}],"responses":{"200":{"description":"OK response."}},"schemes":["http"]}}}} \ No newline at end of file diff --git a/gen/http/openapi.yaml b/gen/http/openapi.yaml index de1d53544c86f83811d1b919ef635d7ae6d911f2..318deff9c50515a43c6516246403fc4ae8b59da5 100644 --- a/gen/http/openapi.yaml +++ b/gen/http/openapi.yaml @@ -90,6 +90,11 @@ paths: description: Cache entry scope required: false type: string + - name: x-cache-ttl + in: header + description: Cache entry TTL in seconds + required: false + type: integer - name: any in: body required: true @@ -124,6 +129,11 @@ paths: description: Cache entry scope required: false type: string + - name: x-cache-ttl + in: header + description: Cache entry TTL in seconds + required: false + type: integer - name: any in: body required: true diff --git a/gen/http/openapi3.json b/gen/http/openapi3.json index 8d4aa5274b05969283f7034a291da6ac37702cb3..5ca1b4375609d2baac7a6b758f36b94141c1e3a2 100644 --- a/gen/http/openapi3.json +++ b/gen/http/openapi3.json @@ -1 +1 @@ -{"openapi":"3.0.3","info":{"title":"Cache Service","description":"The cache service exposes interface for working with Redis.","version":"1.0"},"servers":[{"url":"http://localhost:8083","description":"Cache 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/cache":{"get":{"tags":["cache"],"summary":"Get cache","description":"Get JSON value from the cache.","operationId":"cache#Get","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry key","example":"did:web:example.com"},"example":"did:web:example.com"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry namespace","example":"Login"},"example":"Login"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry scope","example":"administration"},"example":"administration"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","example":"Delectus quaerat molestiae placeat nemo.","format":"binary"},"example":"Quia dolores rem."}}}}},"post":{"tags":["cache"],"summary":"Set cache","description":"Set a JSON value in the cache.","operationId":"cache#Set","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry key","example":"did:web:example.com"},"example":"did:web:example.com"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry namespace","example":"Login"},"example":"Login"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry scope","example":"administration"},"example":"administration"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"string","example":"Quis rerum velit sunt rerum dignissimos at.","format":"binary"},"example":"Est illum."}}},"responses":{"201":{"description":"Created response."}}}},"/v1/external/cache":{"post":{"tags":["cache"],"summary":"SetExternal cache","description":"Set an external JSON value in the cache and provide an event for the input.","operationId":"cache#SetExternal","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry key","example":"did:web:example.com"},"example":"did:web:example.com"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry namespace","example":"Login"},"example":"Login"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry scope","example":"administration"},"example":"administration"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"string","example":"Molestiae minima.","format":"binary"},"example":"Repellendus quo."}}},"responses":{"200":{"description":"OK response."}}}}},"components":{},"tags":[{"name":"health","description":"Health service provides health check endpoints."},{"name":"cache","description":"Cache service allows storing and retrieving data from distributed cache."}]} \ No newline at end of file +{"openapi":"3.0.3","info":{"title":"Cache Service","description":"The cache service exposes interface for working with Redis.","version":"1.0"},"servers":[{"url":"http://localhost:8083","description":"Cache 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/cache":{"get":{"tags":["cache"],"summary":"Get cache","description":"Get JSON value from the cache.","operationId":"cache#Get","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry key","example":"did:web:example.com"},"example":"did:web:example.com"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry namespace","example":"Login"},"example":"Login"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry scope","example":"administration"},"example":"administration"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","example":"Delectus quaerat molestiae placeat nemo.","format":"binary"},"example":"Quia dolores rem."}}}}},"post":{"tags":["cache"],"summary":"Set cache","description":"Set a JSON value in the cache.","operationId":"cache#Set","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry key","example":"did:web:example.com"},"example":"did:web:example.com"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry namespace","example":"Login"},"example":"Login"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry scope","example":"administration"},"example":"administration"},{"name":"x-cache-ttl","in":"header","description":"Cache entry TTL in seconds","allowEmptyValue":true,"schema":{"type":"integer","description":"Cache entry TTL in seconds","example":60,"format":"int64"},"example":60}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"string","example":"Quis rerum velit sunt rerum dignissimos at.","format":"binary"},"example":"Est illum."}}},"responses":{"201":{"description":"Created response."}}}},"/v1/external/cache":{"post":{"tags":["cache"],"summary":"SetExternal cache","description":"Set an external JSON value in the cache and provide an event for the input.","operationId":"cache#SetExternal","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry key","example":"did:web:example.com"},"example":"did:web:example.com"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry namespace","example":"Login"},"example":"Login"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","allowEmptyValue":true,"schema":{"type":"string","description":"Cache entry scope","example":"administration"},"example":"administration"},{"name":"x-cache-ttl","in":"header","description":"Cache entry TTL in seconds","allowEmptyValue":true,"schema":{"type":"integer","description":"Cache entry TTL in seconds","example":60,"format":"int64"},"example":60}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"string","example":"Molestiae minima.","format":"binary"},"example":"Repellendus quo."}}},"responses":{"200":{"description":"OK response."}}}}},"components":{},"tags":[{"name":"health","description":"Health service provides health check endpoints."},{"name":"cache","description":"Cache service allows storing and retrieving data from distributed cache."}]} \ No newline at end of file diff --git a/gen/http/openapi3.yaml b/gen/http/openapi3.yaml index ab267c9df93456850584fb983e06e467749a2542..5b5d95762fe4893de50198869bb9753df65c4a8f 100644 --- a/gen/http/openapi3.yaml +++ b/gen/http/openapi3.yaml @@ -106,6 +106,16 @@ paths: description: Cache entry scope example: administration example: administration + - name: x-cache-ttl + in: header + description: Cache entry TTL in seconds + allowEmptyValue: true + schema: + type: integer + description: Cache entry TTL in seconds + example: 60 + format: int64 + example: 60 requestBody: required: true content: @@ -154,6 +164,16 @@ paths: description: Cache entry scope example: administration example: administration + - name: x-cache-ttl + in: header + description: Cache entry TTL in seconds + allowEmptyValue: true + schema: + type: integer + description: Cache entry TTL in seconds + example: 60 + format: int64 + example: 60 requestBody: required: true content: