Fix compilation of command
This commit is contained in:
1 parent
19f74a8247
commit
6254e18698
5 files changed
+31
-30
No files matched your search
@@ -11,6 +11,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/hashicorp/watchtower/api"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/posener/complete"
|
"github.com/posener/complete"
|
||||||
)
|
)
|
||||||
@@ -77,7 +78,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
|
|||||||
addrStringVar := &StringVar{
|
addrStringVar := &StringVar{
|
||||||
Name: FlagNameAddress,
|
Name: FlagNameAddress,
|
||||||
Target: &c.Address,
|
Target: &c.Address,
|
||||||
EnvVar: EnvWatchtowerAddress,
|
EnvVar: api.EnvWatchtowerAddress,
|
||||||
Completion: complete.PredictAnything,
|
Completion: complete.PredictAnything,
|
||||||
Usage: "Address of the Watchtower controller.",
|
Usage: "Address of the Watchtower controller.",
|
||||||
}
|
}
|
||||||
@@ -92,7 +93,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
|
|||||||
Name: FlagNameCACert,
|
Name: FlagNameCACert,
|
||||||
Target: &c.flagCACert,
|
Target: &c.flagCACert,
|
||||||
Default: "",
|
Default: "",
|
||||||
EnvVar: EnvWatchtowerCACert,
|
EnvVar: api.EnvWatchtowerCACert,
|
||||||
Completion: complete.PredictFiles("*"),
|
Completion: complete.PredictFiles("*"),
|
||||||
Usage: "Path on the local disk to a single PEM-encoded CA " +
|
Usage: "Path on the local disk to a single PEM-encoded CA " +
|
||||||
"certificate to verify the Controller or Worker's server's SSL certificate. This " +
|
"certificate to verify the Controller or Worker's server's SSL certificate. This " +
|
||||||
@@ -103,7 +104,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
|
|||||||
Name: FlagNameCAPath,
|
Name: FlagNameCAPath,
|
||||||
Target: &c.flagCAPath,
|
Target: &c.flagCAPath,
|
||||||
Default: "",
|
Default: "",
|
||||||
EnvVar: EnvWatchtowerCAPath,
|
EnvVar: api.EnvWatchtowerCAPath,
|
||||||
Completion: complete.PredictDirs("*"),
|
Completion: complete.PredictDirs("*"),
|
||||||
Usage: "Path on the local disk to a directory of PEM-encoded CA " +
|
Usage: "Path on the local disk to a directory of PEM-encoded CA " +
|
||||||
"certificates to verify the SSL certificate of the Controller.",
|
"certificates to verify the SSL certificate of the Controller.",
|
||||||
@@ -113,7 +114,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
|
|||||||
Name: FlagNameClientCert,
|
Name: FlagNameClientCert,
|
||||||
Target: &c.flagClientCert,
|
Target: &c.flagClientCert,
|
||||||
Default: "",
|
Default: "",
|
||||||
EnvVar: EnvWatchtowerClientCert,
|
EnvVar: api.EnvWatchtowerClientCert,
|
||||||
Completion: complete.PredictFiles("*"),
|
Completion: complete.PredictFiles("*"),
|
||||||
Usage: "Path on the local disk to a single PEM-encoded CA " +
|
Usage: "Path on the local disk to a single PEM-encoded CA " +
|
||||||
"certificate to use for TLS authentication to the Watchtower Controller. If " +
|
"certificate to use for TLS authentication to the Watchtower Controller. If " +
|
||||||
@@ -124,7 +125,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
|
|||||||
Name: FlagNameClientKey,
|
Name: FlagNameClientKey,
|
||||||
Target: &c.flagClientKey,
|
Target: &c.flagClientKey,
|
||||||
Default: "",
|
Default: "",
|
||||||
EnvVar: EnvWatchtowerClientKey,
|
EnvVar: api.EnvWatchtowerClientKey,
|
||||||
Completion: complete.PredictFiles("*"),
|
Completion: complete.PredictFiles("*"),
|
||||||
Usage: "Path on the local disk to a single PEM-encoded private key " +
|
Usage: "Path on the local disk to a single PEM-encoded private key " +
|
||||||
"matching the client certificate from -client-cert.",
|
"matching the client certificate from -client-cert.",
|
||||||
@@ -134,7 +135,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
|
|||||||
Name: FlagTLSServerName,
|
Name: FlagTLSServerName,
|
||||||
Target: &c.flagTLSServerName,
|
Target: &c.flagTLSServerName,
|
||||||
Default: "",
|
Default: "",
|
||||||
EnvVar: EnvWatchtowerTLSServerName,
|
EnvVar: api.EnvWatchtowerTLSServerName,
|
||||||
Completion: complete.PredictAnything,
|
Completion: complete.PredictAnything,
|
||||||
Usage: "Name to use as the SNI host when connecting to the Watchtower " +
|
Usage: "Name to use as the SNI host when connecting to the Watchtower " +
|
||||||
"server via TLS.",
|
"server via TLS.",
|
||||||
@@ -144,7 +145,7 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
|
|||||||
Name: FlagNameTLSInsecure,
|
Name: FlagNameTLSInsecure,
|
||||||
Target: &c.flagTLSInsecure,
|
Target: &c.flagTLSInsecure,
|
||||||
Default: false,
|
Default: false,
|
||||||
EnvVar: EnvWatchtowerTLSInsecure,
|
EnvVar: api.EnvWatchtowerTLSInsecure,
|
||||||
Usage: "Disable verification of TLS certificates. Using this option " +
|
Usage: "Disable verification of TLS certificates. Using this option " +
|
||||||
"is highly discouraged as it decreases the security of data " +
|
"is highly discouraged as it decreases the security of data " +
|
||||||
"transmissions to and from the Watchtower server.",
|
"transmissions to and from the Watchtower server.",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||||
"github.com/hashicorp/vault/internalshared/configutil"
|
"github.com/hashicorp/vault/internalshared/configutil"
|
||||||
"github.com/hashicorp/watchtower/globals"
|
"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_catalogs"
|
||||||
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/host_sets"
|
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/host_sets"
|
||||||
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/hosts"
|
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/hosts"
|
||||||
@@ -18,7 +18,7 @@ type HandlerProperties struct {
|
|||||||
ListenerConfig *configutil.Listener
|
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.
|
// its own to mount the Vault API within another web server.
|
||||||
func Handler(props HandlerProperties) http.Handler {
|
func Handler(props HandlerProperties) http.Handler {
|
||||||
// Create the muxer to handle the actual endpoints
|
// Create the muxer to handle the actual endpoints
|
||||||
@@ -34,9 +34,9 @@ func Handler(props HandlerProperties) http.Handler {
|
|||||||
func handleGrpcGateway() http.Handler {
|
func handleGrpcGateway() http.Handler {
|
||||||
ignored := context.Background()
|
ignored := context.Background()
|
||||||
mux := runtime.NewServeMux()
|
mux := runtime.NewServeMux()
|
||||||
api.RegisterHostCatalogServiceHandlerServer(ignored, mux, &host_catalogs.Service{})
|
services.RegisterHostCatalogServiceHandlerServer(ignored, mux, &host_catalogs.Service{})
|
||||||
api.RegisterHostSetServiceHandlerServer(ignored, mux, &host_sets.Service{})
|
services.RegisterHostSetServiceHandlerServer(ignored, mux, &host_sets.Service{})
|
||||||
api.RegisterHostServiceHandlerServer(ignored, mux, &hosts.Service{})
|
services.RegisterHostServiceHandlerServer(ignored, mux, &hosts.Service{})
|
||||||
|
|
||||||
return mux
|
return mux
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,21 +3,21 @@ package host_catalogs
|
|||||||
import (
|
import (
|
||||||
"context"
|
"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/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct {
|
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)
|
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) {
|
func (s Service) DeleteHostCatalog(ctx context.Context, req *services.DeleteHostCatalogRequest) (*services.DeleteHostCatalogResponse, error) {
|
||||||
return &api.DeleteHostCatalogResponse{Existed: false}, nil
|
return &services.DeleteHostCatalogResponse{Existed: false}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ api.HostCatalogServiceServer = &Service{}
|
var _ services.HostCatalogServiceServer = &Service{}
|
||||||
@@ -3,21 +3,21 @@ package host_sets
|
|||||||
import (
|
import (
|
||||||
"context"
|
"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/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct {
|
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)
|
return nil, status.Errorf(codes.NotFound, "Org %q not found", req.OrgId)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Service) DeleteHostSet(context.Context, *api.DeleteHostSetRequest) (*api.DeleteHostSetResponse, error) {
|
func (s Service) DeleteHostSet(context.Context, *services.DeleteHostSetRequest) (*services.DeleteHostSetResponse, error) {
|
||||||
return &api.DeleteHostSetResponse{Existed: false}, nil
|
return &services.DeleteHostSetResponse{Existed: false}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ api.HostSetServiceServer = &Service{}
|
var _ services.HostSetServiceServer = &Service{}
|
||||||
@@ -3,21 +3,21 @@ package hosts
|
|||||||
import (
|
import (
|
||||||
"context"
|
"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/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct {
|
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)
|
return nil, status.Errorf(codes.NotFound, "Org %q not found", req.OrgId)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Service) DeleteHost(context.Context, *api.DeleteHostRequest) (*api.DeleteHostResponse, error) {
|
func (s Service) DeleteHost(context.Context, *services.DeleteHostRequest) (*services.DeleteHostResponse, error) {
|
||||||
return &api.DeleteHostResponse{}, nil
|
return &services.DeleteHostResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ api.HostServiceServer = &Service{}
|
var _ services.HostServiceServer = &Service{}
|
||||||
Reference in new issue
Block a user