cloudapi: V2

V2 is compliant with api.openshift.com design guidelines.

Errors are predefined, have codes, and are queryable.

All requests have an operationId set: a unique identifier which is
sortable by time. This is added to the response in case of an error.

All returned objects have the href, id, and kind field set.
This commit is contained in:
sanne 2021-08-25 16:49:17 +02:00 committed by Sanne Raymaekers
parent 19eb65e9fd
commit 5a9d8c792b
28 changed files with 4877 additions and 585 deletions

View file

@ -9,6 +9,8 @@ import (
"github.com/openshift-online/ocm-sdk-go/authentication"
"github.com/openshift-online/ocm-sdk-go/logging"
"github.com/osbuild/osbuild-composer/internal/common"
)
// When using this handler for auth, it should be run as high up as possible.
@ -54,6 +56,12 @@ func BuildJWTAuthHandler(keysURL, caFile, aclFile string, exclude []string, next
for _, e := range exclude {
builder = builder.Public(e)
}
// In case authentication fails, attach an OperationID
builder = builder.OperationID(func(r *http.Request) string {
return common.GenerateOperationID()
})
handler, err = builder.Next(next).Build()
return
}