feat(worker): Support running AWS host plugin
This commit is contained in:
1 parent
60dc0ec3ff
commit
ee9f9fb4a1
6 files changed
+2401
-8
No files matched your search
@@ -499,14 +499,12 @@ func (c *Command) Run(args []string) int {
|
||||
}
|
||||
}
|
||||
|
||||
// append storage-enabled plugins
|
||||
c.EnabledPlugins = append(c.EnabledPlugins, base.EnabledPluginAws)
|
||||
c.EnabledPlugins = append(c.EnabledPlugins, base.EnabledPluginAws, base.EnabledPluginHostAzure)
|
||||
if base.MinioEnabled {
|
||||
c.EnabledPlugins = append(c.EnabledPlugins, base.EnabledPluginMinio)
|
||||
}
|
||||
|
||||
if c.Config.Controller != nil {
|
||||
// append host-only plugins
|
||||
c.EnabledPlugins = append(c.EnabledPlugins, base.EnabledPluginHostAzure)
|
||||
if err := c.StartController(c.Context); err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return base.CommandCliError
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/event"
|
||||
pb "github.com/hashicorp/boundary/internal/gen/controller/servers"
|
||||
pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services"
|
||||
wpbs "github.com/hashicorp/boundary/internal/gen/worker/servers/services"
|
||||
"github.com/hashicorp/boundary/internal/server"
|
||||
"github.com/hashicorp/boundary/internal/storage"
|
||||
boundary_plugin_assets "github.com/hashicorp/boundary/plugins/boundary"
|
||||
@@ -115,6 +116,12 @@ var initializeReverseGrpcClientCollectors = noopInitializePromCollectors
|
||||
|
||||
func noopInitializePromCollectors(r prometheus.Registerer) {}
|
||||
|
||||
var hostServiceServerFactory func(
|
||||
ctx context.Context,
|
||||
plgClients map[string]plgpb.HostPluginServiceClient,
|
||||
enableLoopback bool,
|
||||
) (wpbs.HostServiceServer, error)
|
||||
|
||||
const (
|
||||
authenticationStatusNeverAuthenticated uint32 = iota
|
||||
authenticationStatusFirstAuthentication
|
||||
@@ -203,6 +210,8 @@ type Worker struct {
|
||||
statusLock sync.Mutex
|
||||
|
||||
downstreamConnManager *cluster.DownstreamManager
|
||||
|
||||
HostServiceServer wpbs.HostServiceServer
|
||||
}
|
||||
|
||||
func New(ctx context.Context, conf *Config) (*Worker, error) {
|
||||
@@ -252,11 +261,47 @@ func New(ctx context.Context, conf *Config) (*Worker, error) {
|
||||
w.localStorageState.Store(server.NotConfiguredLocalStorageState)
|
||||
}
|
||||
|
||||
if w.conf.RawConfig.Worker.RecordingStoragePath != "" && recordingStorageFactory != nil {
|
||||
pluginLogger, err := event.NewHclogLogger(ctx, w.conf.Server.Eventer)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating storage catalog plugin logger: %w", err)
|
||||
pluginLogger, err := event.NewHclogLogger(ctx, w.conf.Server.Eventer)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating plugin logger: %w", err)
|
||||
}
|
||||
|
||||
w.HostServiceServer = wpbs.UnimplementedHostServiceServer{}
|
||||
if hostServiceServerFactory != nil {
|
||||
enableLoopback := false
|
||||
|
||||
hostPlgClients := make(map[string]plgpb.HostPluginServiceClient)
|
||||
for _, enabledPlugin := range w.conf.Server.EnabledPlugins {
|
||||
switch {
|
||||
case enabledPlugin == base.EnabledPluginHostAzure && !w.conf.SkipPlugins,
|
||||
enabledPlugin == base.EnabledPluginAws && !w.conf.SkipPlugins:
|
||||
pluginType := strings.ToLower(enabledPlugin.String())
|
||||
client, cleanup, err := external_plugins.CreateHostPlugin(
|
||||
ctx,
|
||||
pluginType,
|
||||
external_plugins.WithPluginOptions(
|
||||
pluginutil.WithPluginExecutionDirectory(conf.RawConfig.Plugins.ExecutionDir),
|
||||
pluginutil.WithPluginsFilesystem(boundary_plugin_assets.PluginPrefix, boundary_plugin_assets.FileSystem()),
|
||||
),
|
||||
external_plugins.WithLogger(pluginLogger.Named(pluginType)),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating %s host plugin: %w", pluginType, err)
|
||||
}
|
||||
conf.ShutdownFuncs = append(conf.ShutdownFuncs, cleanup)
|
||||
hostPlgClients[pluginType] = client
|
||||
case enabledPlugin == base.EnabledPluginLoopback:
|
||||
enableLoopback = true
|
||||
}
|
||||
}
|
||||
hs, err := hostServiceServerFactory(ctx, hostPlgClients, enableLoopback)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create host service server: %w", err)
|
||||
}
|
||||
w.HostServiceServer = hs
|
||||
}
|
||||
|
||||
if w.conf.RawConfig.Worker.RecordingStoragePath != "" && recordingStorageFactory != nil {
|
||||
plgClients := make(map[string]plgpb.StoragePluginServiceClient)
|
||||
var enableStorageLoopback bool
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/db"
|
||||
"github.com/hashicorp/boundary/internal/event"
|
||||
"github.com/hashicorp/boundary/internal/gen/controller/servers/services"
|
||||
wpbs "github.com/hashicorp/boundary/internal/gen/worker/servers/services"
|
||||
"github.com/hashicorp/boundary/internal/server"
|
||||
"github.com/hashicorp/boundary/internal/util"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
@@ -170,6 +171,24 @@ func TestWorkerNew(t *testing.T) {
|
||||
assert.Equal(t, w.localStorageState.Load().(server.LocalStorageState).String(), server.UnknownLocalStorageState.String())
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "worker host service server is the unimplemented one by default",
|
||||
in: &Config{
|
||||
Server: &base.Server{
|
||||
Listeners: []*base.ServerListener{
|
||||
{Config: &listenerutil.ListenerConfig{Purpose: []string{"proxy"}}},
|
||||
},
|
||||
},
|
||||
RawConfig: &config.Config{
|
||||
Worker: &config.Worker{},
|
||||
SharedConfig: &configutil.SharedConfig{DisableMlock: true},
|
||||
},
|
||||
},
|
||||
expErr: false,
|
||||
assertions: func(t *testing.T, w *Worker) {
|
||||
assert.Equal(t, wpbs.UnimplementedHostServiceServer{}, w.HostServiceServer)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@@ -185,6 +204,10 @@ func TestWorkerNew(t *testing.T) {
|
||||
tt.in.Eventer = event.SysEventer()
|
||||
}
|
||||
|
||||
currentHostServiceFactory := hostServiceServerFactory
|
||||
hostServiceServerFactory = nil
|
||||
t.Cleanup(func() { hostServiceServerFactory = currentHostServiceFactory })
|
||||
|
||||
w, err := New(context.Background(), tt.in)
|
||||
if tt.expErr {
|
||||
require.EqualError(t, err, tt.expErrMsg)
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,512 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.3.0
|
||||
// - protoc (unknown)
|
||||
// source: worker/servers/services/v1/host_service.proto
|
||||
|
||||
package services
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
HostService_NormalizeCatalogData_FullMethodName = "/worker.servers.services.v1.HostService/NormalizeCatalogData"
|
||||
HostService_OnCreateCatalog_FullMethodName = "/worker.servers.services.v1.HostService/OnCreateCatalog"
|
||||
HostService_OnUpdateCatalog_FullMethodName = "/worker.servers.services.v1.HostService/OnUpdateCatalog"
|
||||
HostService_OnDeleteCatalog_FullMethodName = "/worker.servers.services.v1.HostService/OnDeleteCatalog"
|
||||
HostService_NormalizeSetData_FullMethodName = "/worker.servers.services.v1.HostService/NormalizeSetData"
|
||||
HostService_OnCreateSet_FullMethodName = "/worker.servers.services.v1.HostService/OnCreateSet"
|
||||
HostService_OnUpdateSet_FullMethodName = "/worker.servers.services.v1.HostService/OnUpdateSet"
|
||||
HostService_OnDeleteSet_FullMethodName = "/worker.servers.services.v1.HostService/OnDeleteSet"
|
||||
HostService_ListHosts_FullMethodName = "/worker.servers.services.v1.HostService/ListHosts"
|
||||
)
|
||||
|
||||
// HostServiceClient is the client API for HostService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type HostServiceClient interface {
|
||||
// NormalizeCatalogData is a hook that passes attributes to the plugin and
|
||||
// allows those values to be normalized prior to creating or updating those
|
||||
// values in the host catalog data.
|
||||
//
|
||||
// NormalizeCatalogData is useful for converting the values of attributes from
|
||||
// a certain format/type to an expected value format/type. This is useful
|
||||
// during migration of values.
|
||||
//
|
||||
// NormalizeCatalogData is called before the values of attributes are persisted.
|
||||
// All normalized values will be persisted in Boundary and returned
|
||||
// to all clients.
|
||||
//
|
||||
// NormalizeCatalogData could affect other clients. For example, on Terraform,
|
||||
// if data is passed to Boundary and then normalized into a new data
|
||||
// structure, it could cause diffs in Terraform for unchanged values.
|
||||
// This is because, the data structure in Terraform's state will now be
|
||||
// different from the normalized data structure returned from Boundary.
|
||||
//
|
||||
// NormalizeCatalogData is called before:
|
||||
// * OnCreateCatalog
|
||||
// * OnUpdateCatalog
|
||||
NormalizeCatalogData(ctx context.Context, in *NormalizeCatalogDataRequest, opts ...grpc.CallOption) (*NormalizeCatalogDataResponse, error)
|
||||
// OnCreateCatalog is a hook that runs when a
|
||||
// host catalog is created.
|
||||
OnCreateCatalog(ctx context.Context, in *OnCreateCatalogRequest, opts ...grpc.CallOption) (*OnCreateCatalogResponse, error)
|
||||
// OnUpdateCatalog is a hook that runs when a host catalog is
|
||||
// updated.
|
||||
OnUpdateCatalog(ctx context.Context, in *OnUpdateCatalogRequest, opts ...grpc.CallOption) (*OnUpdateCatalogResponse, error)
|
||||
// OnDeleteCatalog is a hook that runs when a host catalog is
|
||||
// deleted.
|
||||
OnDeleteCatalog(ctx context.Context, in *OnDeleteCatalogRequest, opts ...grpc.CallOption) (*OnDeleteCatalogResponse, error)
|
||||
// NormalizeSetData is a hook that passes attributes to the plugin and
|
||||
// allows those values to be normalized prior to creating or updating those
|
||||
// values in the host set data.
|
||||
//
|
||||
// NormalizeSetData is useful for converting the values of attributes from
|
||||
// a certain format/type to an expected value format/type. This is useful
|
||||
// during migration of values.
|
||||
//
|
||||
// NormalizeSetData is called before the values of attributes are persisted.
|
||||
// All normalized values will be persisted in Boundary and returned
|
||||
// to all clients.
|
||||
//
|
||||
// NormalizeSetData could affect other clients. For example, on Terraform,
|
||||
// if data is passed to Boundary and then normalized into a new data
|
||||
// structure, it could cause diffs in Terraform for unchanged values.
|
||||
// This is because, the data structure in Terraform's state will now be
|
||||
// different from the normalized data structure returned from Boundary.
|
||||
//
|
||||
// NormalizeSetData is called before:
|
||||
// * OnCreateSet
|
||||
// * OnUpdateSet
|
||||
NormalizeSetData(ctx context.Context, in *NormalizeSetDataRequest, opts ...grpc.CallOption) (*NormalizeSetDataResponse, error)
|
||||
// OnCreateSet is a hook that runs when a host set is created.
|
||||
OnCreateSet(ctx context.Context, in *OnCreateSetRequest, opts ...grpc.CallOption) (*OnCreateSetResponse, error)
|
||||
// OnUpdateSet is a hook that runs when a host set is updated.
|
||||
OnUpdateSet(ctx context.Context, in *OnUpdateSetRequest, opts ...grpc.CallOption) (*OnUpdateSetResponse, error)
|
||||
// OnDeleteSet is a hook that runs when a host set is deleted.
|
||||
OnDeleteSet(ctx context.Context, in *OnDeleteSetRequest, opts ...grpc.CallOption) (*OnDeleteSetResponse, error)
|
||||
// ListHosts looks up all the hosts in the provided host sets.
|
||||
ListHosts(ctx context.Context, in *ListHostsRequest, opts ...grpc.CallOption) (*ListHostsResponse, error)
|
||||
}
|
||||
|
||||
type hostServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewHostServiceClient(cc grpc.ClientConnInterface) HostServiceClient {
|
||||
return &hostServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *hostServiceClient) NormalizeCatalogData(ctx context.Context, in *NormalizeCatalogDataRequest, opts ...grpc.CallOption) (*NormalizeCatalogDataResponse, error) {
|
||||
out := new(NormalizeCatalogDataResponse)
|
||||
err := c.cc.Invoke(ctx, HostService_NormalizeCatalogData_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *hostServiceClient) OnCreateCatalog(ctx context.Context, in *OnCreateCatalogRequest, opts ...grpc.CallOption) (*OnCreateCatalogResponse, error) {
|
||||
out := new(OnCreateCatalogResponse)
|
||||
err := c.cc.Invoke(ctx, HostService_OnCreateCatalog_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *hostServiceClient) OnUpdateCatalog(ctx context.Context, in *OnUpdateCatalogRequest, opts ...grpc.CallOption) (*OnUpdateCatalogResponse, error) {
|
||||
out := new(OnUpdateCatalogResponse)
|
||||
err := c.cc.Invoke(ctx, HostService_OnUpdateCatalog_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *hostServiceClient) OnDeleteCatalog(ctx context.Context, in *OnDeleteCatalogRequest, opts ...grpc.CallOption) (*OnDeleteCatalogResponse, error) {
|
||||
out := new(OnDeleteCatalogResponse)
|
||||
err := c.cc.Invoke(ctx, HostService_OnDeleteCatalog_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *hostServiceClient) NormalizeSetData(ctx context.Context, in *NormalizeSetDataRequest, opts ...grpc.CallOption) (*NormalizeSetDataResponse, error) {
|
||||
out := new(NormalizeSetDataResponse)
|
||||
err := c.cc.Invoke(ctx, HostService_NormalizeSetData_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *hostServiceClient) OnCreateSet(ctx context.Context, in *OnCreateSetRequest, opts ...grpc.CallOption) (*OnCreateSetResponse, error) {
|
||||
out := new(OnCreateSetResponse)
|
||||
err := c.cc.Invoke(ctx, HostService_OnCreateSet_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *hostServiceClient) OnUpdateSet(ctx context.Context, in *OnUpdateSetRequest, opts ...grpc.CallOption) (*OnUpdateSetResponse, error) {
|
||||
out := new(OnUpdateSetResponse)
|
||||
err := c.cc.Invoke(ctx, HostService_OnUpdateSet_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *hostServiceClient) OnDeleteSet(ctx context.Context, in *OnDeleteSetRequest, opts ...grpc.CallOption) (*OnDeleteSetResponse, error) {
|
||||
out := new(OnDeleteSetResponse)
|
||||
err := c.cc.Invoke(ctx, HostService_OnDeleteSet_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *hostServiceClient) ListHosts(ctx context.Context, in *ListHostsRequest, opts ...grpc.CallOption) (*ListHostsResponse, error) {
|
||||
out := new(ListHostsResponse)
|
||||
err := c.cc.Invoke(ctx, HostService_ListHosts_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// HostServiceServer is the server API for HostService service.
|
||||
// All implementations must embed UnimplementedHostServiceServer
|
||||
// for forward compatibility
|
||||
type HostServiceServer interface {
|
||||
// NormalizeCatalogData is a hook that passes attributes to the plugin and
|
||||
// allows those values to be normalized prior to creating or updating those
|
||||
// values in the host catalog data.
|
||||
//
|
||||
// NormalizeCatalogData is useful for converting the values of attributes from
|
||||
// a certain format/type to an expected value format/type. This is useful
|
||||
// during migration of values.
|
||||
//
|
||||
// NormalizeCatalogData is called before the values of attributes are persisted.
|
||||
// All normalized values will be persisted in Boundary and returned
|
||||
// to all clients.
|
||||
//
|
||||
// NormalizeCatalogData could affect other clients. For example, on Terraform,
|
||||
// if data is passed to Boundary and then normalized into a new data
|
||||
// structure, it could cause diffs in Terraform for unchanged values.
|
||||
// This is because, the data structure in Terraform's state will now be
|
||||
// different from the normalized data structure returned from Boundary.
|
||||
//
|
||||
// NormalizeCatalogData is called before:
|
||||
// * OnCreateCatalog
|
||||
// * OnUpdateCatalog
|
||||
NormalizeCatalogData(context.Context, *NormalizeCatalogDataRequest) (*NormalizeCatalogDataResponse, error)
|
||||
// OnCreateCatalog is a hook that runs when a
|
||||
// host catalog is created.
|
||||
OnCreateCatalog(context.Context, *OnCreateCatalogRequest) (*OnCreateCatalogResponse, error)
|
||||
// OnUpdateCatalog is a hook that runs when a host catalog is
|
||||
// updated.
|
||||
OnUpdateCatalog(context.Context, *OnUpdateCatalogRequest) (*OnUpdateCatalogResponse, error)
|
||||
// OnDeleteCatalog is a hook that runs when a host catalog is
|
||||
// deleted.
|
||||
OnDeleteCatalog(context.Context, *OnDeleteCatalogRequest) (*OnDeleteCatalogResponse, error)
|
||||
// NormalizeSetData is a hook that passes attributes to the plugin and
|
||||
// allows those values to be normalized prior to creating or updating those
|
||||
// values in the host set data.
|
||||
//
|
||||
// NormalizeSetData is useful for converting the values of attributes from
|
||||
// a certain format/type to an expected value format/type. This is useful
|
||||
// during migration of values.
|
||||
//
|
||||
// NormalizeSetData is called before the values of attributes are persisted.
|
||||
// All normalized values will be persisted in Boundary and returned
|
||||
// to all clients.
|
||||
//
|
||||
// NormalizeSetData could affect other clients. For example, on Terraform,
|
||||
// if data is passed to Boundary and then normalized into a new data
|
||||
// structure, it could cause diffs in Terraform for unchanged values.
|
||||
// This is because, the data structure in Terraform's state will now be
|
||||
// different from the normalized data structure returned from Boundary.
|
||||
//
|
||||
// NormalizeSetData is called before:
|
||||
// * OnCreateSet
|
||||
// * OnUpdateSet
|
||||
NormalizeSetData(context.Context, *NormalizeSetDataRequest) (*NormalizeSetDataResponse, error)
|
||||
// OnCreateSet is a hook that runs when a host set is created.
|
||||
OnCreateSet(context.Context, *OnCreateSetRequest) (*OnCreateSetResponse, error)
|
||||
// OnUpdateSet is a hook that runs when a host set is updated.
|
||||
OnUpdateSet(context.Context, *OnUpdateSetRequest) (*OnUpdateSetResponse, error)
|
||||
// OnDeleteSet is a hook that runs when a host set is deleted.
|
||||
OnDeleteSet(context.Context, *OnDeleteSetRequest) (*OnDeleteSetResponse, error)
|
||||
// ListHosts looks up all the hosts in the provided host sets.
|
||||
ListHosts(context.Context, *ListHostsRequest) (*ListHostsResponse, error)
|
||||
mustEmbedUnimplementedHostServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedHostServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedHostServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedHostServiceServer) NormalizeCatalogData(context.Context, *NormalizeCatalogDataRequest) (*NormalizeCatalogDataResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method NormalizeCatalogData not implemented")
|
||||
}
|
||||
func (UnimplementedHostServiceServer) OnCreateCatalog(context.Context, *OnCreateCatalogRequest) (*OnCreateCatalogResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OnCreateCatalog not implemented")
|
||||
}
|
||||
func (UnimplementedHostServiceServer) OnUpdateCatalog(context.Context, *OnUpdateCatalogRequest) (*OnUpdateCatalogResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OnUpdateCatalog not implemented")
|
||||
}
|
||||
func (UnimplementedHostServiceServer) OnDeleteCatalog(context.Context, *OnDeleteCatalogRequest) (*OnDeleteCatalogResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OnDeleteCatalog not implemented")
|
||||
}
|
||||
func (UnimplementedHostServiceServer) NormalizeSetData(context.Context, *NormalizeSetDataRequest) (*NormalizeSetDataResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method NormalizeSetData not implemented")
|
||||
}
|
||||
func (UnimplementedHostServiceServer) OnCreateSet(context.Context, *OnCreateSetRequest) (*OnCreateSetResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OnCreateSet not implemented")
|
||||
}
|
||||
func (UnimplementedHostServiceServer) OnUpdateSet(context.Context, *OnUpdateSetRequest) (*OnUpdateSetResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OnUpdateSet not implemented")
|
||||
}
|
||||
func (UnimplementedHostServiceServer) OnDeleteSet(context.Context, *OnDeleteSetRequest) (*OnDeleteSetResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OnDeleteSet not implemented")
|
||||
}
|
||||
func (UnimplementedHostServiceServer) ListHosts(context.Context, *ListHostsRequest) (*ListHostsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListHosts not implemented")
|
||||
}
|
||||
func (UnimplementedHostServiceServer) mustEmbedUnimplementedHostServiceServer() {}
|
||||
|
||||
// UnsafeHostServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to HostServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeHostServiceServer interface {
|
||||
mustEmbedUnimplementedHostServiceServer()
|
||||
}
|
||||
|
||||
func RegisterHostServiceServer(s grpc.ServiceRegistrar, srv HostServiceServer) {
|
||||
s.RegisterService(&HostService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _HostService_NormalizeCatalogData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NormalizeCatalogDataRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HostServiceServer).NormalizeCatalogData(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HostService_NormalizeCatalogData_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HostServiceServer).NormalizeCatalogData(ctx, req.(*NormalizeCatalogDataRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HostService_OnCreateCatalog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(OnCreateCatalogRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HostServiceServer).OnCreateCatalog(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HostService_OnCreateCatalog_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HostServiceServer).OnCreateCatalog(ctx, req.(*OnCreateCatalogRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HostService_OnUpdateCatalog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(OnUpdateCatalogRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HostServiceServer).OnUpdateCatalog(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HostService_OnUpdateCatalog_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HostServiceServer).OnUpdateCatalog(ctx, req.(*OnUpdateCatalogRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HostService_OnDeleteCatalog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(OnDeleteCatalogRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HostServiceServer).OnDeleteCatalog(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HostService_OnDeleteCatalog_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HostServiceServer).OnDeleteCatalog(ctx, req.(*OnDeleteCatalogRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HostService_NormalizeSetData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NormalizeSetDataRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HostServiceServer).NormalizeSetData(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HostService_NormalizeSetData_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HostServiceServer).NormalizeSetData(ctx, req.(*NormalizeSetDataRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HostService_OnCreateSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(OnCreateSetRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HostServiceServer).OnCreateSet(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HostService_OnCreateSet_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HostServiceServer).OnCreateSet(ctx, req.(*OnCreateSetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HostService_OnUpdateSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(OnUpdateSetRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HostServiceServer).OnUpdateSet(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HostService_OnUpdateSet_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HostServiceServer).OnUpdateSet(ctx, req.(*OnUpdateSetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HostService_OnDeleteSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(OnDeleteSetRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HostServiceServer).OnDeleteSet(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HostService_OnDeleteSet_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HostServiceServer).OnDeleteSet(ctx, req.(*OnDeleteSetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HostService_ListHosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListHostsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HostServiceServer).ListHosts(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HostService_ListHosts_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HostServiceServer).ListHosts(ctx, req.(*ListHostsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// HostService_ServiceDesc is the grpc.ServiceDesc for HostService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var HostService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "worker.servers.services.v1.HostService",
|
||||
HandlerType: (*HostServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "NormalizeCatalogData",
|
||||
Handler: _HostService_NormalizeCatalogData_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "OnCreateCatalog",
|
||||
Handler: _HostService_OnCreateCatalog_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "OnUpdateCatalog",
|
||||
Handler: _HostService_OnUpdateCatalog_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "OnDeleteCatalog",
|
||||
Handler: _HostService_OnDeleteCatalog_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "NormalizeSetData",
|
||||
Handler: _HostService_NormalizeSetData_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "OnCreateSet",
|
||||
Handler: _HostService_OnCreateSet_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "OnUpdateSet",
|
||||
Handler: _HostService_OnUpdateSet_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "OnDeleteSet",
|
||||
Handler: _HostService_OnDeleteSet_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListHosts",
|
||||
Handler: _HostService_ListHosts_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "worker/servers/services/v1/host_service.proto",
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package worker.servers.services.v1;
|
||||
|
||||
import "controller/api/resources/hostcatalogs/v1/host_catalog.proto";
|
||||
import "controller/api/resources/hostsets/v1/host_set.proto";
|
||||
import "controller/api/resources/plugins/v1/plugin.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "plugin/v1/host_plugin_service.proto";
|
||||
|
||||
option go_package = "github.com/hashicorp/boundary/internal/gen/worker/servers/services;services";
|
||||
|
||||
// HostService describes the service for host plugins.
|
||||
service HostService {
|
||||
// NormalizeCatalogData is a hook that passes attributes to the plugin and
|
||||
// allows those values to be normalized prior to creating or updating those
|
||||
// values in the host catalog data.
|
||||
//
|
||||
// NormalizeCatalogData is useful for converting the values of attributes from
|
||||
// a certain format/type to an expected value format/type. This is useful
|
||||
// during migration of values.
|
||||
//
|
||||
// NormalizeCatalogData is called before the values of attributes are persisted.
|
||||
// All normalized values will be persisted in Boundary and returned
|
||||
// to all clients.
|
||||
//
|
||||
// NormalizeCatalogData could affect other clients. For example, on Terraform,
|
||||
// if data is passed to Boundary and then normalized into a new data
|
||||
// structure, it could cause diffs in Terraform for unchanged values.
|
||||
// This is because, the data structure in Terraform's state will now be
|
||||
// different from the normalized data structure returned from Boundary.
|
||||
//
|
||||
// NormalizeCatalogData is called before:
|
||||
// * OnCreateCatalog
|
||||
// * OnUpdateCatalog
|
||||
rpc NormalizeCatalogData(NormalizeCatalogDataRequest) returns (NormalizeCatalogDataResponse);
|
||||
|
||||
// OnCreateCatalog is a hook that runs when a
|
||||
// host catalog is created.
|
||||
rpc OnCreateCatalog(OnCreateCatalogRequest) returns (OnCreateCatalogResponse);
|
||||
|
||||
// OnUpdateCatalog is a hook that runs when a host catalog is
|
||||
// updated.
|
||||
rpc OnUpdateCatalog(OnUpdateCatalogRequest) returns (OnUpdateCatalogResponse);
|
||||
|
||||
// OnDeleteCatalog is a hook that runs when a host catalog is
|
||||
// deleted.
|
||||
rpc OnDeleteCatalog(OnDeleteCatalogRequest) returns (OnDeleteCatalogResponse);
|
||||
|
||||
// NormalizeSetData is a hook that passes attributes to the plugin and
|
||||
// allows those values to be normalized prior to creating or updating those
|
||||
// values in the host set data.
|
||||
//
|
||||
// NormalizeSetData is useful for converting the values of attributes from
|
||||
// a certain format/type to an expected value format/type. This is useful
|
||||
// during migration of values.
|
||||
//
|
||||
// NormalizeSetData is called before the values of attributes are persisted.
|
||||
// All normalized values will be persisted in Boundary and returned
|
||||
// to all clients.
|
||||
//
|
||||
// NormalizeSetData could affect other clients. For example, on Terraform,
|
||||
// if data is passed to Boundary and then normalized into a new data
|
||||
// structure, it could cause diffs in Terraform for unchanged values.
|
||||
// This is because, the data structure in Terraform's state will now be
|
||||
// different from the normalized data structure returned from Boundary.
|
||||
//
|
||||
// NormalizeSetData is called before:
|
||||
// * OnCreateSet
|
||||
// * OnUpdateSet
|
||||
rpc NormalizeSetData(NormalizeSetDataRequest) returns (NormalizeSetDataResponse);
|
||||
|
||||
// OnCreateSet is a hook that runs when a host set is created.
|
||||
rpc OnCreateSet(OnCreateSetRequest) returns (OnCreateSetResponse);
|
||||
|
||||
// OnUpdateSet is a hook that runs when a host set is updated.
|
||||
rpc OnUpdateSet(OnUpdateSetRequest) returns (OnUpdateSetResponse);
|
||||
|
||||
// OnDeleteSet is a hook that runs when a host set is deleted.
|
||||
rpc OnDeleteSet(OnDeleteSetRequest) returns (OnDeleteSetResponse);
|
||||
|
||||
// ListHosts looks up all the hosts in the provided host sets.
|
||||
rpc ListHosts(ListHostsRequest) returns (ListHostsResponse);
|
||||
}
|
||||
|
||||
message NormalizeCatalogDataRequest {
|
||||
// The incoming attributes in the create or update request.
|
||||
google.protobuf.Struct attributes = 100;
|
||||
|
||||
// The plugin information for this request.
|
||||
controller.api.resources.plugins.v1.PluginInfo plugin = 110;
|
||||
}
|
||||
|
||||
message NormalizeCatalogDataResponse {
|
||||
// Outgoing attributes. If nil, no changes will be recorded. If non-nil, the
|
||||
// values here will be used in place of the original set of attributes.
|
||||
google.protobuf.Struct attributes = 100;
|
||||
}
|
||||
|
||||
message OnCreateCatalogRequest {
|
||||
// The host catalog to create. The request may contain optional
|
||||
// secret data to help authenticate the request against a cloud
|
||||
// API.
|
||||
controller.api.resources.hostcatalogs.v1.HostCatalog catalog = 10;
|
||||
}
|
||||
|
||||
message OnCreateCatalogResponse {
|
||||
// Secret data to persist encrypted within Boundary. This should be used to
|
||||
// store authentication data and other necessary configuration to be used in
|
||||
// later hooks and calls. Returning an error from the call will cause this
|
||||
// data to not be persisted. If this is nil, nothing is written.
|
||||
plugin.v1.HostCatalogPersisted persisted = 10;
|
||||
}
|
||||
|
||||
message OnUpdateCatalogRequest {
|
||||
// The existing state of the catalog.
|
||||
controller.api.resources.hostcatalogs.v1.HostCatalog current_catalog = 10;
|
||||
|
||||
// The requested new state of the catalog. This field may contain optional
|
||||
// secret data that may have been updated from old authentication data
|
||||
// contained within the persisted state.
|
||||
controller.api.resources.hostcatalogs.v1.HostCatalog new_catalog = 20;
|
||||
|
||||
// The existing persisted secret data.
|
||||
plugin.v1.HostCatalogPersisted persisted = 30;
|
||||
}
|
||||
|
||||
message OnUpdateCatalogResponse {
|
||||
// The updated secret data to persist encrypted within Boundary. If an error
|
||||
// is returned, the update of the persisted data is aborted. If this is nil,
|
||||
// no changes are written. To remove all values, simply return an allocated
|
||||
// but empty map.
|
||||
plugin.v1.HostCatalogPersisted persisted = 10;
|
||||
}
|
||||
|
||||
message OnDeleteCatalogRequest {
|
||||
// The existing state of the catalog to delete.
|
||||
controller.api.resources.hostcatalogs.v1.HostCatalog catalog = 10;
|
||||
|
||||
// The host sets contained in the catalog being deleted.
|
||||
repeated controller.api.resources.hostsets.v1.HostSet sets = 20;
|
||||
|
||||
// The existing persisted secret data.
|
||||
plugin.v1.HostCatalogPersisted persisted = 30;
|
||||
}
|
||||
|
||||
message OnDeleteCatalogResponse {}
|
||||
|
||||
message NormalizeSetDataRequest {
|
||||
// The incoming attributes in the create or update request.
|
||||
google.protobuf.Struct attributes = 100;
|
||||
|
||||
// The plugin information for this request.
|
||||
controller.api.resources.plugins.v1.PluginInfo plugin = 110;
|
||||
}
|
||||
|
||||
message NormalizeSetDataResponse {
|
||||
// Outgoing attributes. If nil, no changes will be recorded. If non-nil, the
|
||||
// values here will be used in place of the original set of attributes.
|
||||
google.protobuf.Struct attributes = 100;
|
||||
}
|
||||
|
||||
message OnCreateSetRequest {
|
||||
// The host catalog that the set belongs to.
|
||||
controller.api.resources.hostcatalogs.v1.HostCatalog catalog = 10;
|
||||
|
||||
// The host set to create.
|
||||
controller.api.resources.hostsets.v1.HostSet set = 20;
|
||||
|
||||
// The persisted data for the host catalog that the set belongs to.
|
||||
plugin.v1.HostCatalogPersisted persisted = 30;
|
||||
}
|
||||
|
||||
message OnCreateSetResponse {}
|
||||
|
||||
message OnUpdateSetRequest {
|
||||
// The host catalog that the set belongs to.
|
||||
controller.api.resources.hostcatalogs.v1.HostCatalog catalog = 10;
|
||||
|
||||
// The existing state of the host set.
|
||||
controller.api.resources.hostsets.v1.HostSet current_set = 20;
|
||||
|
||||
// The requested new state of the host set.
|
||||
controller.api.resources.hostsets.v1.HostSet new_set = 30;
|
||||
|
||||
// The persisted data for the host catalog that the set belongs to.
|
||||
plugin.v1.HostCatalogPersisted persisted = 40;
|
||||
}
|
||||
|
||||
message OnUpdateSetResponse {}
|
||||
|
||||
message OnDeleteSetRequest {
|
||||
// The host catalog that the set belongs to.
|
||||
controller.api.resources.hostcatalogs.v1.HostCatalog catalog = 10;
|
||||
|
||||
// The host set to delete.
|
||||
controller.api.resources.hostsets.v1.HostSet set = 20;
|
||||
|
||||
// The persisted data for the host catalog that the set belongs to.
|
||||
plugin.v1.HostCatalogPersisted persisted = 30;
|
||||
}
|
||||
|
||||
message OnDeleteSetResponse {}
|
||||
|
||||
message ListHostsRequest {
|
||||
// The host catalog that the supplied host sets belong to.
|
||||
controller.api.resources.hostcatalogs.v1.HostCatalog catalog = 10;
|
||||
|
||||
// The host sets to look up hosts for.
|
||||
repeated controller.api.resources.hostsets.v1.HostSet sets = 20;
|
||||
|
||||
// The persisted data for the host catalog that the supplied host
|
||||
// sets belong to.
|
||||
plugin.v1.HostCatalogPersisted persisted = 30;
|
||||
}
|
||||
|
||||
message ListHostsResponse {
|
||||
// The hosts to return.
|
||||
repeated plugin.v1.ListHostsResponseHost hosts = 10;
|
||||
}
|
||||
Reference in new issue
Block a user