From 3f4129bc14d164cde709e1161bc0c0c4addf1dc2 Mon Sep 17 00:00:00 2001
From: Morten Linderud <morten@linderud.pw>
Date: Mon, 27 Dec 2021 20:45:40 +0100
Subject: [PATCH] Implement /api/v1/version for rekor-server (#569)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* rekor-server: Implement /api/v1/version

This implements a version endpoint for rekor. This helps figure out the
version the server is currently running. It could later be used to
implement version compatibility with CLI utilities.

Example:
   λ rekor main» curl -s localhost:3000/api/v1/version | jq
   {
     "builddate": "'2021-12-27T13:20:32Z'",
     "commit": "12d1a47c7ac986932a2734cb855c642ac01ffde4",
     "treestate": "dirty",
     "version": "v0.4.0-15-g12d1a47-dirty"
   }

This removes some duplication of the build flags and inserts them into
/pkg/api which is then reused across the utilities.

Signed-off-by: Morten Linderud <morten@linderud.pw>

Signed-off-by: Morten Linderud <morten@linderud.pw>

* Generated files

Signed-off-by: Morten Linderud <morten@linderud.pw>
---
 Makefile                                      |   9 +-
 cmd/rekor-cli/app/root.go                     |   5 +-
 cmd/rekor-cli/app/version.go                  |  25 +--
 cmd/rekor-server/app/root.go                  |   5 +-
 cmd/rekor-server/app/version.go               |  25 +--
 openapi.yaml                                  |  31 ++++
 pkg/api/version.go                            |  48 ++++++
 pkg/generated/client/rekor_client.go          |   5 +
 .../server/get_rekor_version_parameters.go    | 142 ++++++++++++++++++
 .../server/get_rekor_version_responses.go     | 131 ++++++++++++++++
 pkg/generated/client/server/server_client.go  |  92 ++++++++++++
 pkg/generated/models/rekor_version.go         | 138 +++++++++++++++++
 .../restapi/configure_rekor_server.go         |   3 +
 pkg/generated/restapi/embedded_spec.go        |  89 +++++++++++
 .../restapi/operations/rekor_server_api.go    |  13 ++
 .../operations/server/get_rekor_version.go    |  72 +++++++++
 .../server/get_rekor_version_parameters.go    |  62 ++++++++
 .../server/get_rekor_version_responses.go     | 132 ++++++++++++++++
 .../server/get_rekor_version_urlbuilder.go    | 100 ++++++++++++
 19 files changed, 1079 insertions(+), 48 deletions(-)
 create mode 100644 pkg/api/version.go
 create mode 100644 pkg/generated/client/server/get_rekor_version_parameters.go
 create mode 100644 pkg/generated/client/server/get_rekor_version_responses.go
 create mode 100644 pkg/generated/client/server/server_client.go
 create mode 100644 pkg/generated/models/rekor_version.go
 create mode 100644 pkg/generated/restapi/operations/server/get_rekor_version.go
 create mode 100644 pkg/generated/restapi/operations/server/get_rekor_version_parameters.go
 create mode 100644 pkg/generated/restapi/operations/server/get_rekor_version_responses.go
 create mode 100644 pkg/generated/restapi/operations/server/get_rekor_version_urlbuilder.go

diff --git a/Makefile b/Makefile
index c496c4e..12083a4 100644
--- a/Makefile
+++ b/Makefile
@@ -49,11 +49,12 @@ export KO_DOCKER_REPO=$(KO_PREFIX)
 SWAGGER := $(TOOLS_BIN_DIR)/swagger
 GO-FUZZ-BUILD := $(TOOLS_BIN_DIR)/go-fuzz-build
 
-CLI_PKG=github.com/sigstore/rekor/cmd/rekor-cli/app
-CLI_LDFLAGS=-X $(CLI_PKG).GitVersion=$(GIT_VERSION) -X $(CLI_PKG).gitCommit=$(GIT_HASH) -X $(CLI_PKG).gitTreeState=$(GIT_TREESTATE) -X $(CLI_PKG).buildDate=$(BUILD_DATE)
+FLAG_PKG=github.com/sigstore/rekor/pkg/api
+REKOR_LDFLAGS=-X $(FLAG_PKG).GitVersion=$(GIT_VERSION) -X $(FLAG_PKG).GitCommit=$(GIT_HASH) -X $(FLAG_PKG).GitTreeState=$(GIT_TREESTATE) -X $(FLAG_PKG).BuildDate=$(BUILD_DATE)
+
+CLI_LDFLAGS=$(REKOR_LDFLAGS)
+SERVER_LDFLAGS=$(REKOR_LDFLAGS)
 
-SERVER_PKG=github.com/sigstore/rekor/cmd/rekor-server/app
-SERVER_LDFLAGS=-X $(SERVER_PKG).GitVersion=$(GIT_VERSION) -X $(SERVER_PKG).gitCommit=$(GIT_HASH) -X $(SERVER_PKG).gitTreeState=$(GIT_TREESTATE) -X $(SERVER_PKG).buildDate=$(BUILD_DATE)
 
 $(GENSRC): $(SWAGGER) $(OPENAPIDEPS)
 	$(SWAGGER) generate client -f openapi.yaml -q -r COPYRIGHT.txt -t pkg/generated --default-consumes application/json\;q=1 --additional-initialism=TUF
diff --git a/cmd/rekor-cli/app/root.go b/cmd/rekor-cli/app/root.go
index d05de56..a70632f 100644
--- a/cmd/rekor-cli/app/root.go
+++ b/cmd/rekor-cli/app/root.go
@@ -25,6 +25,7 @@ import (
 	"github.com/spf13/pflag"
 	"github.com/spf13/viper"
 
+	"github.com/sigstore/rekor/pkg/api"
 	"github.com/sigstore/rekor/pkg/log"
 
 	// these imports are to call the packages' init methods
@@ -72,7 +73,7 @@ func init() {
 	}
 
 	// look for the default version and replace it, if found, from runtime build info
-	if GitVersion != "devel" {
+	if api.GitVersion != "devel" {
 		return
 	}
 
@@ -82,7 +83,7 @@ func init() {
 	}
 	// Version is set in artifacts built with -X github.com/sigstore/rekor/cmd/rekor-cli/app.GitVersion=1.2.3
 	// Ensure version is also set when installed via go install github.com/sigstore/rekor/cmd/rekor-cli
-	GitVersion = bi.Main.Version
+	api.GitVersion = bi.Main.Version
 }
 
 func initConfig(cmd *cobra.Command) error {
diff --git a/cmd/rekor-cli/app/version.go b/cmd/rekor-cli/app/version.go
index 172093a..28f641d 100644
--- a/cmd/rekor-cli/app/version.go
+++ b/cmd/rekor-cli/app/version.go
@@ -23,25 +23,10 @@ import (
 	"text/tabwriter"
 
 	"github.com/pkg/errors"
+	"github.com/sigstore/rekor/pkg/api"
 	"github.com/spf13/cobra"
 )
 
-// Base version information.
-//
-// This is the fallback data used when version information from git is not
-// provided via go ldflags (e.g. via Makefile).
-var (
-	// Output of "git describe". The prerequisite is that the branch should be
-	// tagged using the correct versioning strategy.
-	GitVersion string = "devel"
-	// SHA1 from git, output of $(git rev-parse HEAD)
-	gitCommit = "unknown"
-	// State of git tree, either "clean" or "dirty"
-	gitTreeState = "unknown"
-	// Build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ')
-	buildDate = "unknown"
-)
-
 type versionOptions struct {
 	json bool
 }
@@ -93,10 +78,10 @@ func VersionInfo() Info {
 	// These variables typically come from -ldflags settings and in
 	// their absence fallback to the global defaults set above.
 	return Info{
-		GitVersion:   GitVersion,
-		GitCommit:    gitCommit,
-		GitTreeState: gitTreeState,
-		BuildDate:    buildDate,
+		GitVersion:   api.GitVersion,
+		GitCommit:    api.GitCommit,
+		GitTreeState: api.GitTreeState,
+		BuildDate:    api.BuildDate,
 		GoVersion:    runtime.Version(),
 		Compiler:     runtime.Compiler,
 		Platform:     fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
diff --git a/cmd/rekor-server/app/root.go b/cmd/rekor-server/app/root.go
index 92aa60b..2c7b104 100644
--- a/cmd/rekor-server/app/root.go
+++ b/cmd/rekor-server/app/root.go
@@ -26,6 +26,7 @@ import (
 	"github.com/spf13/cobra"
 	"github.com/spf13/viper"
 
+	"github.com/sigstore/rekor/pkg/api"
 	"github.com/sigstore/rekor/pkg/log"
 )
 
@@ -91,7 +92,7 @@ func init() {
 	rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
 
 	// look for the default version and replace it, if found, from runtime build info
-	if GitVersion != "devel" {
+	if api.GitVersion != "devel" {
 		return
 	}
 	log.Logger.Debugf("pprof enabled %v", enablePprof)
@@ -116,7 +117,7 @@ func init() {
 	}
 	// Version is set in artifacts built with -X github.com/sigstore/rekor/cmd/rekor-server/app.GitVersion=1.2.3
 	// Ensure version is also set when installed via go install github.com/sigstore/rekor/cmd/rekor-server
-	GitVersion = bi.Main.Version
+	api.GitVersion = bi.Main.Version
 }
 
 // initConfig reads in config file and ENV variables if set.
diff --git a/cmd/rekor-server/app/version.go b/cmd/rekor-server/app/version.go
index 917e910..a0ffd77 100644
--- a/cmd/rekor-server/app/version.go
+++ b/cmd/rekor-server/app/version.go
@@ -23,25 +23,10 @@ import (
 	"text/tabwriter"
 
 	"github.com/pkg/errors"
+	"github.com/sigstore/rekor/pkg/api"
 	"github.com/spf13/cobra"
 )
 
-// Base version information.
-//
-// This is the fallback data used when version information from git is not
-// provided via go ldflags (e.g. via Makefile).
-var (
-	// Output of "git describe". The prerequisite is that the branch should be
-	// tagged using the correct versioning strategy.
-	GitVersion string = "devel"
-	// SHA1 from git, output of $(git rev-parse HEAD)
-	gitCommit = "unknown"
-	// State of git tree, either "clean" or "dirty"
-	gitTreeState = "unknown"
-	// Build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ')
-	buildDate = "unknown"
-)
-
 type versionOptions struct {
 	json bool
 }
@@ -93,10 +78,10 @@ func VersionInfo() Info {
 	// These variables typically come from -ldflags settings and in
 	// their absence fallback to the global defaults set above.
 	return Info{
-		GitVersion:   GitVersion,
-		GitCommit:    gitCommit,
-		GitTreeState: gitTreeState,
-		BuildDate:    buildDate,
+		GitVersion:   api.GitVersion,
+		GitCommit:    api.GitCommit,
+		GitTreeState: api.GitTreeState,
+		BuildDate:    api.BuildDate,
 		GoVersion:    runtime.Version(),
 		Compiler:     runtime.Compiler,
 		Platform:     fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
diff --git a/openapi.yaml b/openapi.yaml
index 2c0987c..be741d3 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -31,6 +31,20 @@ produces:
   - application/yaml
 
 paths:
+  /api/v1/version:
+    get:
+      summary: Get the current version of the rekor server
+      operationId: getRekorVersion
+      tags:
+        - server
+      responses:
+        200:
+          description: A JSON object with the running rekor version
+          schema:
+            $ref: '#/definitions/RekorVersion'
+        default:
+          $ref: '#/responses/InternalServerError'
+
   /api/v1/index/retrieve:
     post:
       summary: Searches index by entry metadata
@@ -490,6 +504,23 @@ definitions:
         - "body"
         - "integratedTime"
 
+  RekorVersion:
+    type: object
+    properties:
+      version:
+        type: string
+      commit:
+        type: string
+      treestate:
+        type: string
+      builddate:
+        type: string
+    required:
+      - version
+      - commit
+      - treestate
+      - builddate
+
   SearchIndex:
     type: object
     properties:
diff --git a/pkg/api/version.go b/pkg/api/version.go
new file mode 100644
index 0000000..a10cceb
--- /dev/null
+++ b/pkg/api/version.go
@@ -0,0 +1,48 @@
+//
+// Copyright 2021 The Sigstore Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package api
+
+import (
+	"github.com/go-openapi/runtime/middleware"
+	"github.com/sigstore/rekor/pkg/generated/models"
+	"github.com/sigstore/rekor/pkg/generated/restapi/operations/server"
+)
+
+// Base version information.
+//
+// This is the fallback data used when version information from git is not
+// provided via go ldflags (e.g. via Makefile).
+var (
+	// Output of "git describe". The prerequisite is that the branch should be
+	// tagged using the correct versioning strategy.
+	GitVersion string = "devel"
+	// SHA1 from git, output of $(git rev-parse HEAD)
+	GitCommit = "unknown"
+	// State of git tree, either "clean" or "dirty"
+	GitTreeState = "unknown"
+	// Build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ')
+	BuildDate = "unknown"
+)
+
+func GetRekorVersionHandler(params server.GetRekorVersionParams) middleware.Responder {
+	ver := &models.RekorVersion{
+		Version:   &GitVersion,
+		Commit:    &GitCommit,
+		Treestate: &GitTreeState,
+		Builddate: &BuildDate,
+	}
+	return server.NewGetRekorVersionOK().WithPayload(ver)
+}
diff --git a/pkg/generated/client/rekor_client.go b/pkg/generated/client/rekor_client.go
index b25cb57..d2b1cbc 100644
--- a/pkg/generated/client/rekor_client.go
+++ b/pkg/generated/client/rekor_client.go
@@ -29,6 +29,7 @@ import (
 	"github.com/sigstore/rekor/pkg/generated/client/entries"
 	"github.com/sigstore/rekor/pkg/generated/client/index"
 	"github.com/sigstore/rekor/pkg/generated/client/pubkey"
+	serverops "github.com/sigstore/rekor/pkg/generated/client/server"
 	"github.com/sigstore/rekor/pkg/generated/client/timestamp"
 	"github.com/sigstore/rekor/pkg/generated/client/tlog"
 )
@@ -78,6 +79,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Rekor {
 	cli.Entries = entries.New(transport, formats)
 	cli.Index = index.New(transport, formats)
 	cli.Pubkey = pubkey.New(transport, formats)
+	cli.Server = serverops.New(transport, formats)
 	cli.Timestamp = timestamp.New(transport, formats)
 	cli.Tlog = tlog.New(transport, formats)
 	return cli
@@ -130,6 +132,8 @@ type Rekor struct {
 
 	Pubkey pubkey.ClientService
 
+	Server serverops.ClientService
+
 	Timestamp timestamp.ClientService
 
 	Tlog tlog.ClientService
@@ -143,6 +147,7 @@ func (c *Rekor) SetTransport(transport runtime.ClientTransport) {
 	c.Entries.SetTransport(transport)
 	c.Index.SetTransport(transport)
 	c.Pubkey.SetTransport(transport)
+	c.Server.SetTransport(transport)
 	c.Timestamp.SetTransport(transport)
 	c.Tlog.SetTransport(transport)
 }
diff --git a/pkg/generated/client/server/get_rekor_version_parameters.go b/pkg/generated/client/server/get_rekor_version_parameters.go
new file mode 100644
index 0000000..419217f
--- /dev/null
+++ b/pkg/generated/client/server/get_rekor_version_parameters.go
@@ -0,0 +1,142 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+//
+// Copyright 2021 The Sigstore Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package server
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+	"context"
+	"net/http"
+	"time"
+
+	"github.com/go-openapi/errors"
+	"github.com/go-openapi/runtime"
+	cr "github.com/go-openapi/runtime/client"
+	"github.com/go-openapi/strfmt"
+)
+
+// NewGetRekorVersionParams creates a new GetRekorVersionParams object,
+// with the default timeout for this client.
+//
+// Default values are not hydrated, since defaults are normally applied by the API server side.
+//
+// To enforce default values in parameter, use SetDefaults or WithDefaults.
+func NewGetRekorVersionParams() *GetRekorVersionParams {
+	return &GetRekorVersionParams{
+		timeout: cr.DefaultTimeout,
+	}
+}
+
+// NewGetRekorVersionParamsWithTimeout creates a new GetRekorVersionParams object
+// with the ability to set a timeout on a request.
+func NewGetRekorVersionParamsWithTimeout(timeout time.Duration) *GetRekorVersionParams {
+	return &GetRekorVersionParams{
+		timeout: timeout,
+	}
+}
+
+// NewGetRekorVersionParamsWithContext creates a new GetRekorVersionParams object
+// with the ability to set a context for a request.
+func NewGetRekorVersionParamsWithContext(ctx context.Context) *GetRekorVersionParams {
+	return &GetRekorVersionParams{
+		Context: ctx,
+	}
+}
+
+// NewGetRekorVersionParamsWithHTTPClient creates a new GetRekorVersionParams object
+// with the ability to set a custom HTTPClient for a request.
+func NewGetRekorVersionParamsWithHTTPClient(client *http.Client) *GetRekorVersionParams {
+	return &GetRekorVersionParams{
+		HTTPClient: client,
+	}
+}
+
+/* GetRekorVersionParams contains all the parameters to send to the API endpoint
+   for the get rekor version operation.
+
+   Typically these are written to a http.Request.
+*/
+type GetRekorVersionParams struct {
+	timeout    time.Duration
+	Context    context.Context
+	HTTPClient *http.Client
+}
+
+// WithDefaults hydrates default values in the get rekor version params (not the query body).
+//
+// All values with no default are reset to their zero value.
+func (o *GetRekorVersionParams) WithDefaults() *GetRekorVersionParams {
+	o.SetDefaults()
+	return o
+}
+
+// SetDefaults hydrates default values in the get rekor version params (not the query body).
+//
+// All values with no default are reset to their zero value.
+func (o *GetRekorVersionParams) SetDefaults() {
+	// no default values defined for this parameter
+}
+
+// WithTimeout adds the timeout to the get rekor version params
+func (o *GetRekorVersionParams) WithTimeout(timeout time.Duration) *GetRekorVersionParams {
+	o.SetTimeout(timeout)
+	return o
+}
+
+// SetTimeout adds the timeout to the get rekor version params
+func (o *GetRekorVersionParams) SetTimeout(timeout time.Duration) {
+	o.timeout = timeout
+}
+
+// WithContext adds the context to the get rekor version params
+func (o *GetRekorVersionParams) WithContext(ctx context.Context) *GetRekorVersionParams {
+	o.SetContext(ctx)
+	return o
+}
+
+// SetContext adds the context to the get rekor version params
+func (o *GetRekorVersionParams) SetContext(ctx context.Context) {
+	o.Context = ctx
+}
+
+// WithHTTPClient adds the HTTPClient to the get rekor version params
+func (o *GetRekorVersionParams) WithHTTPClient(client *http.Client) *GetRekorVersionParams {
+	o.SetHTTPClient(client)
+	return o
+}
+
+// SetHTTPClient adds the HTTPClient to the get rekor version params
+func (o *GetRekorVersionParams) SetHTTPClient(client *http.Client) {
+	o.HTTPClient = client
+}
+
+// WriteToRequest writes these params to a swagger request
+func (o *GetRekorVersionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
+
+	if err := r.SetTimeout(o.timeout); err != nil {
+		return err
+	}
+	var res []error
+
+	if len(res) > 0 {
+		return errors.CompositeValidationError(res...)
+	}
+	return nil
+}
diff --git a/pkg/generated/client/server/get_rekor_version_responses.go b/pkg/generated/client/server/get_rekor_version_responses.go
new file mode 100644
index 0000000..fe165ea
--- /dev/null
+++ b/pkg/generated/client/server/get_rekor_version_responses.go
@@ -0,0 +1,131 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+//
+// Copyright 2021 The Sigstore Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package server
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+	"fmt"
+	"io"
+
+	"github.com/go-openapi/runtime"
+	"github.com/go-openapi/strfmt"
+
+	"github.com/sigstore/rekor/pkg/generated/models"
+)
+
+// GetRekorVersionReader is a Reader for the GetRekorVersion structure.
+type GetRekorVersionReader struct {
+	formats strfmt.Registry
+}
+
+// ReadResponse reads a server response into the received o.
+func (o *GetRekorVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
+	switch response.Code() {
+	case 200:
+		result := NewGetRekorVersionOK()
+		if err := result.readResponse(response, consumer, o.formats); err != nil {
+			return nil, err
+		}
+		return result, nil
+	default:
+		result := NewGetRekorVersionDefault(response.Code())
+		if err := result.readResponse(response, consumer, o.formats); err != nil {
+			return nil, err
+		}
+		if response.Code()/100 == 2 {
+			return result, nil
+		}
+		return nil, result
+	}
+}
+
+// NewGetRekorVersionOK creates a GetRekorVersionOK with default headers values
+func NewGetRekorVersionOK() *GetRekorVersionOK {
+	return &GetRekorVersionOK{}
+}
+
+/* GetRekorVersionOK describes a response with status code 200, with default header values.
+
+A JSON object with the running rekor version
+*/
+type GetRekorVersionOK struct {
+	Payload *models.RekorVersion
+}
+
+func (o *GetRekorVersionOK) Error() string {
+	return fmt.Sprintf("[GET /api/v1/version][%d] getRekorVersionOK  %+v", 200, o.Payload)
+}
+func (o *GetRekorVersionOK) GetPayload() *models.RekorVersion {
+	return o.Payload
+}
+
+func (o *GetRekorVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+	o.Payload = new(models.RekorVersion)
+
+	// response payload
+	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
+		return err
+	}
+
+	return nil
+}
+
+// NewGetRekorVersionDefault creates a GetRekorVersionDefault with default headers values
+func NewGetRekorVersionDefault(code int) *GetRekorVersionDefault {
+	return &GetRekorVersionDefault{
+		_statusCode: code,
+	}
+}
+
+/* GetRekorVersionDefault describes a response with status code -1, with default header values.
+
+There was an internal error in the server while processing the request
+*/
+type GetRekorVersionDefault struct {
+	_statusCode int
+
+	Payload *models.Error
+}
+
+// Code gets the status code for the get rekor version default response
+func (o *GetRekorVersionDefault) Code() int {
+	return o._statusCode
+}
+
+func (o *GetRekorVersionDefault) Error() string {
+	return fmt.Sprintf("[GET /api/v1/version][%d] getRekorVersion default  %+v", o._statusCode, o.Payload)
+}
+func (o *GetRekorVersionDefault) GetPayload() *models.Error {
+	return o.Payload
+}
+
+func (o *GetRekorVersionDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
+
+	o.Payload = new(models.Error)
+
+	// response payload
+	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
+		return err
+	}
+
+	return nil
+}
diff --git a/pkg/generated/client/server/server_client.go b/pkg/generated/client/server/server_client.go
new file mode 100644
index 0000000..2bd9b88
--- /dev/null
+++ b/pkg/generated/client/server/server_client.go
@@ -0,0 +1,92 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+//
+// Copyright 2021 The Sigstore Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package server
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+	"github.com/go-openapi/runtime"
+	"github.com/go-openapi/strfmt"
+)
+
+// New creates a new server API client.
+func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
+	return &Client{transport: transport, formats: formats}
+}
+
+/*
+Client for server API
+*/
+type Client struct {
+	transport runtime.ClientTransport
+	formats   strfmt.Registry
+}
+
+// ClientOption is the option for Client methods
+type ClientOption func(*runtime.ClientOperation)
+
+// ClientService is the interface for Client methods
+type ClientService interface {
+	GetRekorVersion(params *GetRekorVersionParams, opts ...ClientOption) (*GetRekorVersionOK, error)
+
+	SetTransport(transport runtime.ClientTransport)
+}
+
+/*
+  GetRekorVersion gets the current version of the rekor server
+*/
+func (a *Client) GetRekorVersion(params *GetRekorVersionParams, opts ...ClientOption) (*GetRekorVersionOK, error) {
+	// TODO: Validate the params before sending
+	if params == nil {
+		params = NewGetRekorVersionParams()
+	}
+	op := &runtime.ClientOperation{
+		ID:                 "getRekorVersion",
+		Method:             "GET",
+		PathPattern:        "/api/v1/version",
+		ProducesMediaTypes: []string{"application/json;q=1", "application/yaml"},
+		ConsumesMediaTypes: []string{"application/json", "application/yaml"},
+		Schemes:            []string{"http"},
+		Params:             params,
+		Reader:             &GetRekorVersionReader{formats: a.formats},
+		Context:            params.Context,
+		Client:             params.HTTPClient,
+	}
+	for _, opt := range opts {
+		opt(op)
+	}
+
+	result, err := a.transport.Submit(op)
+	if err != nil {
+		return nil, err
+	}
+	success, ok := result.(*GetRekorVersionOK)
+	if ok {
+		return success, nil
+	}
+	// unexpected success response
+	unexpectedSuccess := result.(*GetRekorVersionDefault)
+	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
+}
+
+// SetTransport changes the transport on the client
+func (a *Client) SetTransport(transport runtime.ClientTransport) {
+	a.transport = transport
+}
diff --git a/pkg/generated/models/rekor_version.go b/pkg/generated/models/rekor_version.go
new file mode 100644
index 0000000..5201730
--- /dev/null
+++ b/pkg/generated/models/rekor_version.go
@@ -0,0 +1,138 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+//
+// Copyright 2021 The Sigstore Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package models
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+	"context"
+
+	"github.com/go-openapi/errors"
+	"github.com/go-openapi/strfmt"
+	"github.com/go-openapi/swag"
+	"github.com/go-openapi/validate"
+)
+
+// RekorVersion rekor version
+//
+// swagger:model RekorVersion
+type RekorVersion struct {
+
+	// builddate
+	// Required: true
+	Builddate *string `json:"builddate"`
+
+	// commit
+	// Required: true
+	Commit *string `json:"commit"`
+
+	// treestate
+	// Required: true
+	Treestate *string `json:"treestate"`
+
+	// version
+	// Required: true
+	Version *string `json:"version"`
+}
+
+// Validate validates this rekor version
+func (m *RekorVersion) Validate(formats strfmt.Registry) error {
+	var res []error
+
+	if err := m.validateBuilddate(formats); err != nil {
+		res = append(res, err)
+	}
+
+	if err := m.validateCommit(formats); err != nil {
+		res = append(res, err)
+	}
+
+	if err := m.validateTreestate(formats); err != nil {
+		res = append(res, err)
+	}
+
+	if err := m.validateVersion(formats); err != nil {
+		res = append(res, err)
+	}
+
+	if len(res) > 0 {
+		return errors.CompositeValidationError(res...)
+	}
+	return nil
+}
+
+func (m *RekorVersion) validateBuilddate(formats strfmt.Registry) error {
+
+	if err := validate.Required("builddate", "body", m.Builddate); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (m *RekorVersion) validateCommit(formats strfmt.Registry) error {
+
+	if err := validate.Required("commit", "body", m.Commit); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (m *RekorVersion) validateTreestate(formats strfmt.Registry) error {
+
+	if err := validate.Required("treestate", "body", m.Treestate); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (m *RekorVersion) validateVersion(formats strfmt.Registry) error {
+
+	if err := validate.Required("version", "body", m.Version); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+// ContextValidate validates this rekor version based on context it is used
+func (m *RekorVersion) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
+	return nil
+}
+
+// MarshalBinary interface implementation
+func (m *RekorVersion) MarshalBinary() ([]byte, error) {
+	if m == nil {
+		return nil, nil
+	}
+	return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *RekorVersion) UnmarshalBinary(b []byte) error {
+	var res RekorVersion
+	if err := swag.ReadJSON(b, &res); err != nil {
+		return err
+	}
+	*m = res
+	return nil
+}
diff --git a/pkg/generated/restapi/configure_rekor_server.go b/pkg/generated/restapi/configure_rekor_server.go
index c11bb2a..f41b7cd 100644
--- a/pkg/generated/restapi/configure_rekor_server.go
+++ b/pkg/generated/restapi/configure_rekor_server.go
@@ -39,6 +39,7 @@ import (
 	"github.com/sigstore/rekor/pkg/generated/restapi/operations/entries"
 	"github.com/sigstore/rekor/pkg/generated/restapi/operations/index"
 	"github.com/sigstore/rekor/pkg/generated/restapi/operations/pubkey"
+	"github.com/sigstore/rekor/pkg/generated/restapi/operations/server"
 	"github.com/sigstore/rekor/pkg/generated/restapi/operations/timestamp"
 	"github.com/sigstore/rekor/pkg/generated/restapi/operations/tlog"
 	"github.com/sigstore/rekor/pkg/log"
@@ -89,6 +90,8 @@ func configureAPI(api *operations.RekorServerAPI) http.Handler {
 	api.TlogGetLogInfoHandler = tlog.GetLogInfoHandlerFunc(pkgapi.GetLogInfoHandler)
 	api.TlogGetLogProofHandler = tlog.GetLogProofHandlerFunc(pkgapi.GetLogProofHandler)
 
+	api.ServerGetRekorVersionHandler = server.GetRekorVersionHandlerFunc(pkgapi.GetRekorVersionHandler)
+
 	if viper.GetBool("enable_retrieve_api") {
 		api.IndexSearchIndexHandler = index.SearchIndexHandlerFunc(pkgapi.SearchIndexHandler)
 	} else {
diff --git a/pkg/generated/restapi/embedded_spec.go b/pkg/generated/restapi/embedded_spec.go
index 0dde72c..5b91f03 100644
--- a/pkg/generated/restapi/embedded_spec.go
+++ b/pkg/generated/restapi/embedded_spec.go
@@ -411,6 +411,26 @@ func init() {
           }
         }
       }
+    },
+    "/api/v1/version": {
+      "get": {
+        "tags": [
+          "server"
+        ],
+        "summary": "Get the current version of the rekor server",
+        "operationId": "getRekorVersion",
+        "responses": {
+          "200": {
+            "description": "A JSON object with the running rekor version",
+            "schema": {
+              "$ref": "#/definitions/RekorVersion"
+            }
+          },
+          "default": {
+            "$ref": "#/responses/InternalServerError"
+          }
+        }
+      }
     }
   },
   "definitions": {
@@ -569,6 +589,29 @@ func init() {
       },
       "discriminator": "kind"
     },
+    "RekorVersion": {
+      "type": "object",
+      "required": [
+        "version",
+        "commit",
+        "treestate",
+        "builddate"
+      ],
+      "properties": {
+        "builddate": {
+          "type": "string"
+        },
+        "commit": {
+          "type": "string"
+        },
+        "treestate": {
+          "type": "string"
+        },
+        "version": {
+          "type": "string"
+        }
+      }
+    },
     "SearchIndex": {
       "type": "object",
       "properties": {
@@ -1335,6 +1378,29 @@ func init() {
           }
         }
       }
+    },
+    "/api/v1/version": {
+      "get": {
+        "tags": [
+          "server"
+        ],
+        "summary": "Get the current version of the rekor server",
+        "operationId": "getRekorVersion",
+        "responses": {
+          "200": {
+            "description": "A JSON object with the running rekor version",
+            "schema": {
+              "$ref": "#/definitions/RekorVersion"
+            }
+          },
+          "default": {
+            "description": "There was an internal error in the server while processing the request",
+            "schema": {
+              "$ref": "#/definitions/Error"
+            }
+          }
+        }
+      }
     }
   },
   "definitions": {
@@ -2072,6 +2138,29 @@ func init() {
       },
       "discriminator": "kind"
     },
+    "RekorVersion": {
+      "type": "object",
+      "required": [
+        "version",
+        "commit",
+        "treestate",
+        "builddate"
+      ],
+      "properties": {
+        "builddate": {
+          "type": "string"
+        },
+        "commit": {
+          "type": "string"
+        },
+        "treestate": {
+          "type": "string"
+        },
+        "version": {
+          "type": "string"
+        }
+      }
+    },
     "RekordV001SchemaData": {
       "description": "Information about the content associated with the entry",
       "type": "object",
diff --git a/pkg/generated/restapi/operations/rekor_server_api.go b/pkg/generated/restapi/operations/rekor_server_api.go
index 1e69e40..2233110 100644
--- a/pkg/generated/restapi/operations/rekor_server_api.go
+++ b/pkg/generated/restapi/operations/rekor_server_api.go
@@ -40,6 +40,7 @@ import (
 	"github.com/sigstore/rekor/pkg/generated/restapi/operations/entries"
 	"github.com/sigstore/rekor/pkg/generated/restapi/operations/index"
 	"github.com/sigstore/rekor/pkg/generated/restapi/operations/pubkey"
+	serverops "github.com/sigstore/rekor/pkg/generated/restapi/operations/server"
 	"github.com/sigstore/rekor/pkg/generated/restapi/operations/timestamp"
 	"github.com/sigstore/rekor/pkg/generated/restapi/operations/tlog"
 )
@@ -98,6 +99,9 @@ func NewRekorServerAPI(spec *loads.Document) *RekorServerAPI {
 		PubkeyGetPublicKeyHandler: pubkey.GetPublicKeyHandlerFunc(func(params pubkey.GetPublicKeyParams) middleware.Responder {
 			return middleware.NotImplemented("operation pubkey.GetPublicKey has not yet been implemented")
 		}),
+		ServerGetRekorVersionHandler: serverops.GetRekorVersionHandlerFunc(func(params serverops.GetRekorVersionParams) middleware.Responder {
+			return middleware.NotImplemented("operation server.GetRekorVersion has not yet been implemented")
+		}),
 		TimestampGetTimestampCertChainHandler: timestamp.GetTimestampCertChainHandlerFunc(func(params timestamp.GetTimestampCertChainParams) middleware.Responder {
 			return middleware.NotImplemented("operation timestamp.GetTimestampCertChain has not yet been implemented")
 		}),
@@ -176,6 +180,8 @@ type RekorServerAPI struct {
 	TlogGetLogProofHandler tlog.GetLogProofHandler
 	// PubkeyGetPublicKeyHandler sets the operation handler for the get public key operation
 	PubkeyGetPublicKeyHandler pubkey.GetPublicKeyHandler
+	// ServerGetRekorVersionHandler sets the operation handler for the get rekor version operation
+	ServerGetRekorVersionHandler serverops.GetRekorVersionHandler
 	// TimestampGetTimestampCertChainHandler sets the operation handler for the get timestamp cert chain operation
 	TimestampGetTimestampCertChainHandler timestamp.GetTimestampCertChainHandler
 	// TimestampGetTimestampResponseHandler sets the operation handler for the get timestamp response operation
@@ -297,6 +303,9 @@ func (o *RekorServerAPI) Validate() error {
 	if o.PubkeyGetPublicKeyHandler == nil {
 		unregistered = append(unregistered, "pubkey.GetPublicKeyHandler")
 	}
+	if o.ServerGetRekorVersionHandler == nil {
+		unregistered = append(unregistered, "server.GetRekorVersionHandler")
+	}
 	if o.TimestampGetTimestampCertChainHandler == nil {
 		unregistered = append(unregistered, "timestamp.GetTimestampCertChainHandler")
 	}
@@ -436,6 +445,10 @@ func (o *RekorServerAPI) initHandlerCache() {
 	if o.handlers["GET"] == nil {
 		o.handlers["GET"] = make(map[string]http.Handler)
 	}
+	o.handlers["GET"]["/api/v1/version"] = serverops.NewGetRekorVersion(o.context, o.ServerGetRekorVersionHandler)
+	if o.handlers["GET"] == nil {
+		o.handlers["GET"] = make(map[string]http.Handler)
+	}
 	o.handlers["GET"]["/api/v1/timestamp/certchain"] = timestamp.NewGetTimestampCertChain(o.context, o.TimestampGetTimestampCertChainHandler)
 	if o.handlers["POST"] == nil {
 		o.handlers["POST"] = make(map[string]http.Handler)
diff --git a/pkg/generated/restapi/operations/server/get_rekor_version.go b/pkg/generated/restapi/operations/server/get_rekor_version.go
new file mode 100644
index 0000000..0297c52
--- /dev/null
+++ b/pkg/generated/restapi/operations/server/get_rekor_version.go
@@ -0,0 +1,72 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+//
+// Copyright 2021 The Sigstore Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package server
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+	"net/http"
+
+	"github.com/go-openapi/runtime/middleware"
+)
+
+// GetRekorVersionHandlerFunc turns a function with the right signature into a get rekor version handler
+type GetRekorVersionHandlerFunc func(GetRekorVersionParams) middleware.Responder
+
+// Handle executing the request and returning a response
+func (fn GetRekorVersionHandlerFunc) Handle(params GetRekorVersionParams) middleware.Responder {
+	return fn(params)
+}
+
+// GetRekorVersionHandler interface for that can handle valid get rekor version params
+type GetRekorVersionHandler interface {
+	Handle(GetRekorVersionParams) middleware.Responder
+}
+
+// NewGetRekorVersion creates a new http.Handler for the get rekor version operation
+func NewGetRekorVersion(ctx *middleware.Context, handler GetRekorVersionHandler) *GetRekorVersion {
+	return &GetRekorVersion{Context: ctx, Handler: handler}
+}
+
+/* GetRekorVersion swagger:route GET /api/v1/version server getRekorVersion
+
+Get the current version of the rekor server
+
+*/
+type GetRekorVersion struct {
+	Context *middleware.Context
+	Handler GetRekorVersionHandler
+}
+
+func (o *GetRekorVersion) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
+	route, rCtx, _ := o.Context.RouteInfo(r)
+	if rCtx != nil {
+		*r = *rCtx
+	}
+	var Params = NewGetRekorVersionParams()
+	if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
+		o.Context.Respond(rw, r, route.Produces, route, err)
+		return
+	}
+
+	res := o.Handler.Handle(Params) // actually handle the request
+	o.Context.Respond(rw, r, route.Produces, route, res)
+
+}
diff --git a/pkg/generated/restapi/operations/server/get_rekor_version_parameters.go b/pkg/generated/restapi/operations/server/get_rekor_version_parameters.go
new file mode 100644
index 0000000..eb0ba95
--- /dev/null
+++ b/pkg/generated/restapi/operations/server/get_rekor_version_parameters.go
@@ -0,0 +1,62 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+//
+// Copyright 2021 The Sigstore Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package server
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+	"net/http"
+
+	"github.com/go-openapi/errors"
+	"github.com/go-openapi/runtime/middleware"
+)
+
+// NewGetRekorVersionParams creates a new GetRekorVersionParams object
+//
+// There are no default values defined in the spec.
+func NewGetRekorVersionParams() GetRekorVersionParams {
+
+	return GetRekorVersionParams{}
+}
+
+// GetRekorVersionParams contains all the bound params for the get rekor version operation
+// typically these are obtained from a http.Request
+//
+// swagger:parameters getRekorVersion
+type GetRekorVersionParams struct {
+
+	// HTTP Request Object
+	HTTPRequest *http.Request `json:"-"`
+}
+
+// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
+// for simple values it will use straight method calls.
+//
+// To ensure default values, the struct must have been initialized with NewGetRekorVersionParams() beforehand.
+func (o *GetRekorVersionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
+	var res []error
+
+	o.HTTPRequest = r
+
+	if len(res) > 0 {
+		return errors.CompositeValidationError(res...)
+	}
+	return nil
+}
diff --git a/pkg/generated/restapi/operations/server/get_rekor_version_responses.go b/pkg/generated/restapi/operations/server/get_rekor_version_responses.go
new file mode 100644
index 0000000..8845dce
--- /dev/null
+++ b/pkg/generated/restapi/operations/server/get_rekor_version_responses.go
@@ -0,0 +1,132 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+//
+// Copyright 2021 The Sigstore Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package server
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+import (
+	"net/http"
+
+	"github.com/go-openapi/runtime"
+
+	"github.com/sigstore/rekor/pkg/generated/models"
+)
+
+// GetRekorVersionOKCode is the HTTP code returned for type GetRekorVersionOK
+const GetRekorVersionOKCode int = 200
+
+/*GetRekorVersionOK A JSON object with the running rekor version
+
+swagger:response getRekorVersionOK
+*/
+type GetRekorVersionOK struct {
+
+	/*
+	  In: Body
+	*/
+	Payload *models.RekorVersion `json:"body,omitempty"`
+}
+
+// NewGetRekorVersionOK creates GetRekorVersionOK with default headers values
+func NewGetRekorVersionOK() *GetRekorVersionOK {
+
+	return &GetRekorVersionOK{}
+}
+
+// WithPayload adds the payload to the get rekor version o k response
+func (o *GetRekorVersionOK) WithPayload(payload *models.RekorVersion) *GetRekorVersionOK {
+	o.Payload = payload
+	return o
+}
+
+// SetPayload sets the payload to the get rekor version o k response
+func (o *GetRekorVersionOK) SetPayload(payload *models.RekorVersion) {
+	o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *GetRekorVersionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+	rw.WriteHeader(200)
+	if o.Payload != nil {
+		payload := o.Payload
+		if err := producer.Produce(rw, payload); err != nil {
+			panic(err) // let the recovery middleware deal with this
+		}
+	}
+}
+
+/*GetRekorVersionDefault There was an internal error in the server while processing the request
+
+swagger:response getRekorVersionDefault
+*/
+type GetRekorVersionDefault struct {
+	_statusCode int
+
+	/*
+	  In: Body
+	*/
+	Payload *models.Error `json:"body,omitempty"`
+}
+
+// NewGetRekorVersionDefault creates GetRekorVersionDefault with default headers values
+func NewGetRekorVersionDefault(code int) *GetRekorVersionDefault {
+	if code <= 0 {
+		code = 500
+	}
+
+	return &GetRekorVersionDefault{
+		_statusCode: code,
+	}
+}
+
+// WithStatusCode adds the status to the get rekor version default response
+func (o *GetRekorVersionDefault) WithStatusCode(code int) *GetRekorVersionDefault {
+	o._statusCode = code
+	return o
+}
+
+// SetStatusCode sets the status to the get rekor version default response
+func (o *GetRekorVersionDefault) SetStatusCode(code int) {
+	o._statusCode = code
+}
+
+// WithPayload adds the payload to the get rekor version default response
+func (o *GetRekorVersionDefault) WithPayload(payload *models.Error) *GetRekorVersionDefault {
+	o.Payload = payload
+	return o
+}
+
+// SetPayload sets the payload to the get rekor version default response
+func (o *GetRekorVersionDefault) SetPayload(payload *models.Error) {
+	o.Payload = payload
+}
+
+// WriteResponse to the client
+func (o *GetRekorVersionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
+
+	rw.WriteHeader(o._statusCode)
+	if o.Payload != nil {
+		payload := o.Payload
+		if err := producer.Produce(rw, payload); err != nil {
+			panic(err) // let the recovery middleware deal with this
+		}
+	}
+}
diff --git a/pkg/generated/restapi/operations/server/get_rekor_version_urlbuilder.go b/pkg/generated/restapi/operations/server/get_rekor_version_urlbuilder.go
new file mode 100644
index 0000000..8c839d3
--- /dev/null
+++ b/pkg/generated/restapi/operations/server/get_rekor_version_urlbuilder.go
@@ -0,0 +1,100 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+//
+// Copyright 2021 The Sigstore Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package server
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the generate command
+
+import (
+	"errors"
+	"net/url"
+	golangswaggerpaths "path"
+)
+
+// GetRekorVersionURL generates an URL for the get rekor version operation
+type GetRekorVersionURL struct {
+	_basePath string
+}
+
+// WithBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *GetRekorVersionURL) WithBasePath(bp string) *GetRekorVersionURL {
+	o.SetBasePath(bp)
+	return o
+}
+
+// SetBasePath sets the base path for this url builder, only required when it's different from the
+// base path specified in the swagger spec.
+// When the value of the base path is an empty string
+func (o *GetRekorVersionURL) SetBasePath(bp string) {
+	o._basePath = bp
+}
+
+// Build a url path and query string
+func (o *GetRekorVersionURL) Build() (*url.URL, error) {
+	var _result url.URL
+
+	var _path = "/api/v1/version"
+
+	_basePath := o._basePath
+	_result.Path = golangswaggerpaths.Join(_basePath, _path)
+
+	return &_result, nil
+}
+
+// Must is a helper function to panic when the url builder returns an error
+func (o *GetRekorVersionURL) Must(u *url.URL, err error) *url.URL {
+	if err != nil {
+		panic(err)
+	}
+	if u == nil {
+		panic("url can't be nil")
+	}
+	return u
+}
+
+// String returns the string representation of the path with query string
+func (o *GetRekorVersionURL) String() string {
+	return o.Must(o.Build()).String()
+}
+
+// BuildFull builds a full url with scheme, host, path and query string
+func (o *GetRekorVersionURL) BuildFull(scheme, host string) (*url.URL, error) {
+	if scheme == "" {
+		return nil, errors.New("scheme is required for a full url on GetRekorVersionURL")
+	}
+	if host == "" {
+		return nil, errors.New("host is required for a full url on GetRekorVersionURL")
+	}
+
+	base, err := o.Build()
+	if err != nil {
+		return nil, err
+	}
+
+	base.Scheme = scheme
+	base.Host = host
+	return base, nil
+}
+
+// StringFull returns the string representation of a complete url
+func (o *GetRekorVersionURL) StringFull(scheme, host string) string {
+	return o.Must(o.BuildFull(scheme, host)).String()
+}
-- 
GitLab