Make API not depend on SDK (#18962)

This commit is contained in:
Nick Cabatoff
2023-02-06 09:41:56 -05:00
committed by GitHub
parent b5d7d47ca2
commit 192baa88db
39 changed files with 315 additions and 449 deletions

View File

@@ -5,7 +5,6 @@ import (
"strings"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/sdk/helper/consts"
"github.com/mitchellh/cli"
"github.com/posener/complete"
)
@@ -90,12 +89,12 @@ func (c *PluginListCommand) Run(args []string) int {
return 1
}
pluginType := consts.PluginTypeUnknown
pluginType := api.PluginTypeUnknown
if len(args) > 0 {
pluginTypeStr := strings.TrimSpace(args[0])
if pluginTypeStr != "" {
var err error
pluginType, err = consts.ParsePluginType(pluginTypeStr)
pluginType, err = api.ParsePluginType(pluginTypeStr)
if err != nil {
c.UI.Error(fmt.Sprintf("Error parsing type: %s", err))
return 2
@@ -139,10 +138,10 @@ func (c *PluginListCommand) Run(args []string) int {
}
}
func (c *PluginListCommand) simpleResponse(plugins *api.ListPluginsResponse, pluginType consts.PluginType) []string {
func (c *PluginListCommand) simpleResponse(plugins *api.ListPluginsResponse, pluginType api.PluginType) []string {
var out []string
switch pluginType {
case consts.PluginTypeUnknown:
case api.PluginTypeUnknown:
out = []string{"Name | Type | Version"}
for _, plugin := range plugins.Details {
out = append(out, fmt.Sprintf("%s | %s | %s", plugin.Name, plugin.Type, plugin.Version))