feat(host/plugin): Always send plugin information on DHC requests

This commit is contained in:
Hugo committed 2024-09-30 21:24:18 +01:00
1 parent c3d03f69d8
commit 60dc0ec3ff
11 files changed
+440 -289

No files matched your search

+24
View File
@@ -15,6 +15,8 @@ import (
"github.com/hashicorp/boundary/internal/host/plugin/store"
"github.com/hashicorp/boundary/internal/libs/crypto"
"github.com/hashicorp/boundary/internal/oplog"
"github.com/hashicorp/boundary/internal/plugin"
plgstore "github.com/hashicorp/boundary/internal/plugin/store"
"github.com/hashicorp/boundary/internal/types/resource"
wrapping "github.com/hashicorp/go-kms-wrapping/v2"
"google.golang.org/protobuf/proto"
@@ -142,6 +144,8 @@ func (c *HostCatalog) oplog(op oplog.OpType) oplog.Metadata {
return metadata
}
// TODO: Refactor repository (catalogAgg + getPlugin) uses to just use
// catalogAgg + catalogAgg.plugin().
type catalogAgg struct {
PublicId string `gorm:"primary_key"`
ProjectId string
@@ -158,6 +162,12 @@ type catalogAgg struct {
KeyId string
PersistedCreateTime *timestamp.Timestamp
PersistedUpdateTime *timestamp.Timestamp
PluginScopeId string
PluginName string
PluginDescription string
PluginCreateTime *timestamp.Timestamp
PluginUpdateTime *timestamp.Timestamp
PluginVersion uint32
}
func (agg *catalogAgg) toCatalogAndPersisted() (*HostCatalog, *HostCatalogSecret) {
@@ -189,6 +199,20 @@ func (agg *catalogAgg) toCatalogAndPersisted() (*HostCatalog, *HostCatalogSecret
return c, s
}
func (agg *catalogAgg) plugin() *plugin.Plugin {
return &plugin.Plugin{
Plugin: &plgstore.Plugin{
PublicId: agg.PluginId,
ScopeId: agg.PluginScopeId,
Name: agg.PluginName,
Description: agg.PluginDescription,
CreateTime: agg.PluginCreateTime,
UpdateTime: agg.PluginUpdateTime,
Version: agg.PluginVersion,
},
}
}
// TableName returns the table name for gorm
func (agg *catalogAgg) TableName() string {
return "host_plugin_catalog_with_secret"