api: add gRPC definition for version endpoint.

This commit is contained in:
rithu john
2016-11-09 12:33:33 -08:00
parent 36ade89e54
commit de4e23a27b
3 changed files with 141 additions and 49 deletions

View File

@@ -10,8 +10,13 @@ import (
"github.com/coreos/dex/api"
"github.com/coreos/dex/storage"
"github.com/coreos/dex/version"
)
// apiVersion increases everytime a new call is added to the API. Clients should use this info
// to determine if the server supports specific features.
const apiVersion = 0
// NewAPI returns a server which implements the gRPC API interface.
func NewAPI(s storage.Storage) api.DexServer {
return dexAPI{s: s}
@@ -159,3 +164,10 @@ func (d dexAPI) DeletePassword(ctx context.Context, req *api.DeletePasswordReq)
return &api.DeletePasswordResp{}, nil
}
func (d dexAPI) GetVersion(ctx context.Context, req *api.VersionReq) (*api.VersionResp, error) {
return &api.VersionResp{
Server: version.Version,
Api: apiVersion,
}, nil
}