Fix compilation of command

This commit is contained in:
Jeff Mitchell committed 2020-05-04 12:41:36 -04:00
1 parent 19f74a8247
commit 6254e18698
5 files changed
+31 -30

No files matched your search

+5 -5
View File
@@ -8,7 +8,7 @@ import (
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/hashicorp/vault/internalshared/configutil"
"github.com/hashicorp/watchtower/globals"
"github.com/hashicorp/watchtower/internal/gen/controller/api"
"github.com/hashicorp/watchtower/internal/gen/controller/api/services"
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/host_catalogs"
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/host_sets"
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/hosts"
@@ -18,7 +18,7 @@ type HandlerProperties struct {
ListenerConfig *configutil.Listener
}
// Handler returns an http.Handler for the API. This can be used on
// Handler returns an http.Handler for the services. This can be used on
// its own to mount the Vault API within another web server.
func Handler(props HandlerProperties) http.Handler {
// Create the muxer to handle the actual endpoints
@@ -34,9 +34,9 @@ func Handler(props HandlerProperties) http.Handler {
func handleGrpcGateway() http.Handler {
ignored := context.Background()
mux := runtime.NewServeMux()
api.RegisterHostCatalogServiceHandlerServer(ignored, mux, &host_catalogs.Service{})
api.RegisterHostSetServiceHandlerServer(ignored, mux, &host_sets.Service{})
api.RegisterHostServiceHandlerServer(ignored, mux, &hosts.Service{})
services.RegisterHostCatalogServiceHandlerServer(ignored, mux, &host_catalogs.Service{})
services.RegisterHostSetServiceHandlerServer(ignored, mux, &host_sets.Service{})
services.RegisterHostServiceHandlerServer(ignored, mux, &hosts.Service{})
return mux
}
@@ -3,21 +3,21 @@ package host_catalogs
import (
"context"
"github.com/hashicorp/watchtower/internal/gen/controller/api"
"github.com/hashicorp/watchtower/internal/gen/controller/api/services"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type Service struct {
*api.UnimplementedHostCatalogServiceServer
*services.UnimplementedHostCatalogServiceServer
}
func (s Service) ListHostCatalogs(ctx context.Context, req *api.ListHostCatalogsRequest) (*api.ListHostCatalogsResponse, error) {
func (s Service) ListHostCatalogs(ctx context.Context, req *services.ListHostCatalogsRequest) (*services.ListHostCatalogsResponse, error) {
return nil, status.Errorf(codes.NotFound, "Org %q not found", req.OrgId)
}
func (s Service) DeleteHostCatalog(ctx context.Context, req *api.DeleteHostCatalogRequest) (*api.DeleteHostCatalogResponse, error) {
return &api.DeleteHostCatalogResponse{Existed: false}, nil
func (s Service) DeleteHostCatalog(ctx context.Context, req *services.DeleteHostCatalogRequest) (*services.DeleteHostCatalogResponse, error) {
return &services.DeleteHostCatalogResponse{Existed: false}, nil
}
var _ api.HostCatalogServiceServer = &Service{}
var _ services.HostCatalogServiceServer = &Service{}
@@ -3,21 +3,21 @@ package host_sets
import (
"context"
"github.com/hashicorp/watchtower/internal/gen/controller/api"
"github.com/hashicorp/watchtower/internal/gen/controller/api/services"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type Service struct {
*api.UnimplementedHostSetServiceServer
*services.UnimplementedHostSetServiceServer
}
func (s Service) ListHostSets(ctx context.Context, req *api.ListHostSetsRequest) (*api.ListHostSetsResponse, error) {
func (s Service) ListHostSets(ctx context.Context, req *services.ListHostSetsRequest) (*services.ListHostSetsResponse, error) {
return nil, status.Errorf(codes.NotFound, "Org %q not found", req.OrgId)
}
func (s Service) DeleteHostSet(context.Context, *api.DeleteHostSetRequest) (*api.DeleteHostSetResponse, error) {
return &api.DeleteHostSetResponse{Existed: false}, nil
func (s Service) DeleteHostSet(context.Context, *services.DeleteHostSetRequest) (*services.DeleteHostSetResponse, error) {
return &services.DeleteHostSetResponse{Existed: false}, nil
}
var _ api.HostSetServiceServer = &Service{}
var _ services.HostSetServiceServer = &Service{}
@@ -3,21 +3,21 @@ package hosts
import (
"context"
"github.com/hashicorp/watchtower/internal/gen/controller/api"
"github.com/hashicorp/watchtower/internal/gen/controller/api/services"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type Service struct {
*api.UnimplementedHostServiceServer
*services.UnimplementedHostServiceServer
}
func (s Service) ListHosts(ctx context.Context, req *api.ListHostsRequest) (*api.ListHostsResponse, error) {
func (s Service) ListHosts(ctx context.Context, req *services.ListHostsRequest) (*services.ListHostsResponse, error) {
return nil, status.Errorf(codes.NotFound, "Org %q not found", req.OrgId)
}
func (s Service) DeleteHost(context.Context, *api.DeleteHostRequest) (*api.DeleteHostResponse, error) {
return &api.DeleteHostResponse{}, nil
func (s Service) DeleteHost(context.Context, *services.DeleteHostRequest) (*services.DeleteHostResponse, error) {
return &services.DeleteHostResponse{}, nil
}
var _ api.HostServiceServer = &Service{}
var _ services.HostServiceServer = &Service{}