Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add application/x-sigstore-tle as response type #2262

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ paths:
required: true
minimum: 0
description: specifies the index of the entry in the transparency log to be retrieved
produces:
- application/json
- application/x-sigstore-tle
responses:
200:
description: the entry in the transparency log requested along with an inclusion proof
Expand All @@ -211,6 +214,9 @@ paths:
required: true
pattern: '^([0-9a-fA-F]{64}|[0-9a-fA-F]{80})$'
description: the UUID of the entry for which the inclusion proof information should be returned
produces:
- application/json
- application/x-sigstore-tle
responses:
200:
description: Information needed for a client to compute the inclusion proof
Expand All @@ -233,6 +239,9 @@ paths:
required: true
schema:
$ref: '#/definitions/SearchLogQuery'
produces:
- application/json
- application/x-sigstore-tle
responses:
200:
description: Returns zero or more entries from the transparency log, according to how many were included in request query
Expand Down
3 changes: 3 additions & 0 deletions pkg/client/rekor_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/hashicorp/go-cleanhttp"
retryablehttp "github.com/hashicorp/go-retryablehttp"
"github.com/sigstore/rekor/pkg/generated/client"
"github.com/sigstore/rekor/pkg/tle"
"github.com/sigstore/rekor/pkg/util"
)

Expand Down Expand Up @@ -64,7 +65,9 @@ func GetRekorClient(rekorServerURL string, opts ...Option) (*client.Rekor, error
rt := httptransport.NewWithClient(url.Host, url.Path, []string{url.Scheme}, httpClient)
rt.Consumers["application/json"] = runtime.JSONConsumer()
rt.Consumers["application/x-pem-file"] = runtime.TextConsumer()
rt.Consumers[tle.TLEMediaType] = &tle.Consumer{}
rt.Producers["application/json"] = runtime.JSONProducer()
rt.DefaultMediaType = "application/json"

registry := strfmt.Default
registry.Add("signedCheckpoint", &util.SignedNote{}, util.SignedCheckpointValidator)
Expand Down
30 changes: 27 additions & 3 deletions pkg/generated/client/entries/entries_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/generated/restapi/configure_rekor_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"github.com/sigstore/rekor/pkg/generated/restapi/operations/pubkey"
"github.com/sigstore/rekor/pkg/generated/restapi/operations/tlog"
"github.com/sigstore/rekor/pkg/log"
"github.com/sigstore/rekor/pkg/tle"
"github.com/sigstore/rekor/pkg/util"

"golang.org/x/exp/slices"
Expand Down Expand Up @@ -88,6 +89,7 @@ func configureAPI(api *operations.RekorServerAPI) http.Handler {
api.JSONProducer = runtime.JSONProducer()

api.ApplicationXPemFileProducer = runtime.TextProducer()
api.ApplicationXSigstoreTleProducer = &tle.Producer{}

// disable all endpoints to start
api.IndexSearchIndexHandler = index.SearchIndexHandlerFunc(pkgapi.SearchIndexNotImplementedHandler)
Expand Down Expand Up @@ -159,6 +161,8 @@ func configureAPI(api *operations.RekorServerAPI) http.Handler {
api.ServerShutdown = func() {
pkgapi.StopAPI()
}
// the trailing space is intentional to cause checking to fail inside go-openapi but ordering to be enforced from openapi.yaml
api.SetDefaultProduces("application/json ")

return setupGlobalMiddleware(api.Serve(setupMiddlewares))
}
Expand Down
1 change: 1 addition & 0 deletions pkg/generated/restapi/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions pkg/generated/restapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions pkg/generated/restapi/operations/rekor_server_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading