Make API not depend on SDK (#18962)
This commit is contained in:
parent
9d09dba7ac
commit
53afd2627b
|
@ -63,7 +63,7 @@ func (a *Auth) MFAValidate(ctx context.Context, mfaSecret *Secret, payload map[s
|
||||||
return nil, fmt.Errorf("secret does not contain MFARequirements")
|
return nil, fmt.Errorf("secret does not contain MFARequirements")
|
||||||
}
|
}
|
||||||
|
|
||||||
s, err := a.c.Sys().MFAValidateWithContext(ctx, mfaSecret.Auth.MFARequirement.GetMFARequestID(), payload)
|
s, err := a.c.Sys().MFAValidateWithContext(ctx, mfaSecret.Auth.MFARequirement.MFARequestID, payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@ package api
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/sdk/logical"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockAuthMethod struct {
|
type mockAuthMethod struct {
|
||||||
|
@ -91,7 +89,7 @@ func TestAuth_MFALoginTwoPhase(t *testing.T) {
|
||||||
m: &mockAuthMethod{
|
m: &mockAuthMethod{
|
||||||
mockedSecret: &Secret{
|
mockedSecret: &Secret{
|
||||||
Auth: &SecretAuth{
|
Auth: &SecretAuth{
|
||||||
MFARequirement: &logical.MFARequirement{
|
MFARequirement: &MFARequirement{
|
||||||
MFARequestID: "a-req-id",
|
MFARequestID: "a-req-id",
|
||||||
MFAConstraints: nil,
|
MFAConstraints: nil,
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,12 +24,9 @@ import (
|
||||||
"github.com/hashicorp/go-retryablehttp"
|
"github.com/hashicorp/go-retryablehttp"
|
||||||
"github.com/hashicorp/go-rootcerts"
|
"github.com/hashicorp/go-rootcerts"
|
||||||
"github.com/hashicorp/go-secure-stdlib/parseutil"
|
"github.com/hashicorp/go-secure-stdlib/parseutil"
|
||||||
|
"github.com/hashicorp/go-secure-stdlib/strutil"
|
||||||
"golang.org/x/net/http2"
|
"golang.org/x/net/http2"
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/hashicorp/vault/sdk/helper/strutil"
|
|
||||||
"github.com/hashicorp/vault/sdk/logical"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -56,7 +53,19 @@ const (
|
||||||
HeaderIndex = "X-Vault-Index"
|
HeaderIndex = "X-Vault-Index"
|
||||||
HeaderForward = "X-Vault-Forward"
|
HeaderForward = "X-Vault-Forward"
|
||||||
HeaderInconsistent = "X-Vault-Inconsistent"
|
HeaderInconsistent = "X-Vault-Inconsistent"
|
||||||
TLSErrorString = "This error usually means that the server is running with TLS disabled\n" +
|
|
||||||
|
// NamespaceHeaderName is the header set to specify which namespace the
|
||||||
|
// request is indented for.
|
||||||
|
NamespaceHeaderName = "X-Vault-Namespace"
|
||||||
|
|
||||||
|
// AuthHeaderName is the name of the header containing the token.
|
||||||
|
AuthHeaderName = "X-Vault-Token"
|
||||||
|
|
||||||
|
// RequestHeaderName is the name of the header used by the Agent for
|
||||||
|
// SSRF protection.
|
||||||
|
RequestHeaderName = "X-Vault-Request"
|
||||||
|
|
||||||
|
TLSErrorString = "This error usually means that the server is running with TLS disabled\n" +
|
||||||
"but the client is configured to use TLS. Please either enable TLS\n" +
|
"but the client is configured to use TLS. Please either enable TLS\n" +
|
||||||
"on the server or run the client with -address set to an address\n" +
|
"on the server or run the client with -address set to an address\n" +
|
||||||
"that uses the http protocol:\n\n" +
|
"that uses the http protocol:\n\n" +
|
||||||
|
@ -621,7 +630,7 @@ func NewClient(c *Config) (*Client, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the VaultRequest SSRF protection header
|
// Add the VaultRequest SSRF protection header
|
||||||
client.headers[consts.RequestHeaderName] = []string{"true"}
|
client.headers[RequestHeaderName] = []string{"true"}
|
||||||
|
|
||||||
if token := os.Getenv(EnvVaultToken); token != "" {
|
if token := os.Getenv(EnvVaultToken); token != "" {
|
||||||
client.token = token
|
client.token = token
|
||||||
|
@ -938,7 +947,7 @@ func (c *Client) setNamespace(namespace string) {
|
||||||
c.headers = make(http.Header)
|
c.headers = make(http.Header)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.headers.Set(consts.NamespaceHeaderName, namespace)
|
c.headers.Set(NamespaceHeaderName, namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearNamespace removes the namespace header if set.
|
// ClearNamespace removes the namespace header if set.
|
||||||
|
@ -946,7 +955,7 @@ func (c *Client) ClearNamespace() {
|
||||||
c.modifyLock.Lock()
|
c.modifyLock.Lock()
|
||||||
defer c.modifyLock.Unlock()
|
defer c.modifyLock.Unlock()
|
||||||
if c.headers != nil {
|
if c.headers != nil {
|
||||||
c.headers.Del(consts.NamespaceHeaderName)
|
c.headers.Del(NamespaceHeaderName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -958,7 +967,7 @@ func (c *Client) Namespace() string {
|
||||||
if c.headers == nil {
|
if c.headers == nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return c.headers.Get(consts.NamespaceHeaderName)
|
return c.headers.Get(NamespaceHeaderName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithNamespace makes a shallow copy of Client, modifies it to use
|
// WithNamespace makes a shallow copy of Client, modifies it to use
|
||||||
|
@ -1292,7 +1301,7 @@ func (c *Client) rawRequestWithContext(ctx context.Context, r *Request) (*Respon
|
||||||
checkRetry := c.config.CheckRetry
|
checkRetry := c.config.CheckRetry
|
||||||
backoff := c.config.Backoff
|
backoff := c.config.Backoff
|
||||||
httpClient := c.config.HttpClient
|
httpClient := c.config.HttpClient
|
||||||
ns := c.headers.Get(consts.NamespaceHeaderName)
|
ns := c.headers.Get(NamespaceHeaderName)
|
||||||
outputCurlString := c.config.OutputCurlString
|
outputCurlString := c.config.OutputCurlString
|
||||||
outputPolicy := c.config.OutputPolicy
|
outputPolicy := c.config.OutputPolicy
|
||||||
logger := c.config.Logger
|
logger := c.config.Logger
|
||||||
|
@ -1305,9 +1314,9 @@ func (c *Client) rawRequestWithContext(ctx context.Context, r *Request) (*Respon
|
||||||
// e.g. calls using (*Client).WithNamespace
|
// e.g. calls using (*Client).WithNamespace
|
||||||
switch ns {
|
switch ns {
|
||||||
case "":
|
case "":
|
||||||
r.Headers.Del(consts.NamespaceHeaderName)
|
r.Headers.Del(NamespaceHeaderName)
|
||||||
default:
|
default:
|
||||||
r.Headers.Set(consts.NamespaceHeaderName, ns)
|
r.Headers.Set(NamespaceHeaderName, ns)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, cb := range c.requestCallbacks {
|
for _, cb := range c.requestCallbacks {
|
||||||
|
@ -1460,8 +1469,8 @@ func (c *Client) httpRequestWithContext(ctx context.Context, r *Request) (*Respo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// explicitly set the namespace header to current client
|
// explicitly set the namespace header to current client
|
||||||
if ns := c.headers.Get(consts.NamespaceHeaderName); ns != "" {
|
if ns := c.headers.Get(NamespaceHeaderName); ns != "" {
|
||||||
r.Headers.Set(consts.NamespaceHeaderName, ns)
|
r.Headers.Set(NamespaceHeaderName, ns)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1482,7 +1491,7 @@ func (c *Client) httpRequestWithContext(ctx context.Context, r *Request) (*Respo
|
||||||
req.Host = r.URL.Host
|
req.Host = r.URL.Host
|
||||||
|
|
||||||
if len(r.ClientToken) != 0 {
|
if len(r.ClientToken) != 0 {
|
||||||
req.Header.Set(consts.AuthHeaderName, r.ClientToken)
|
req.Header.Set(AuthHeaderName, r.ClientToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(r.WrapTTL) != 0 {
|
if len(r.WrapTTL) != 0 {
|
||||||
|
@ -1672,7 +1681,13 @@ func MergeReplicationStates(old []string, new string) []string {
|
||||||
return strutil.RemoveDuplicates(ret, false)
|
return strutil.RemoveDuplicates(ret, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseReplicationState(raw string, hmacKey []byte) (*logical.WALState, error) {
|
type WALState struct {
|
||||||
|
ClusterID string
|
||||||
|
LocalIndex uint64
|
||||||
|
ReplicatedIndex uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
func ParseReplicationState(raw string, hmacKey []byte) (*WALState, error) {
|
||||||
cooked, err := base64.StdEncoding.DecodeString(raw)
|
cooked, err := base64.StdEncoding.DecodeString(raw)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -1710,7 +1725,7 @@ func ParseReplicationState(raw string, hmacKey []byte) (*logical.WALState, error
|
||||||
return nil, fmt.Errorf("invalid replicated index in state header: %w", err)
|
return nil, fmt.Errorf("invalid replicated index in state header: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &logical.WALState{
|
return &WALState{
|
||||||
ClusterID: pieces[1],
|
ClusterID: pieces[1],
|
||||||
LocalIndex: localIndex,
|
LocalIndex: localIndex,
|
||||||
ReplicatedIndex: replicatedIndex,
|
ReplicatedIndex: replicatedIndex,
|
||||||
|
|
|
@ -19,7 +19,6 @@ import (
|
||||||
|
|
||||||
"github.com/go-test/deep"
|
"github.com/go-test/deep"
|
||||||
"github.com/hashicorp/go-hclog"
|
"github.com/hashicorp/go-hclog"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -442,7 +441,7 @@ func TestClientDeprecatedEnvSettings(t *testing.T) {
|
||||||
func TestClientEnvNamespace(t *testing.T) {
|
func TestClientEnvNamespace(t *testing.T) {
|
||||||
var seenNamespace string
|
var seenNamespace string
|
||||||
handler := func(w http.ResponseWriter, req *http.Request) {
|
handler := func(w http.ResponseWriter, req *http.Request) {
|
||||||
seenNamespace = req.Header.Get(consts.NamespaceHeaderName)
|
seenNamespace = req.Header.Get(NamespaceHeaderName)
|
||||||
}
|
}
|
||||||
config, ln := testHTTPServer(t, http.HandlerFunc(handler))
|
config, ln := testHTTPServer(t, http.HandlerFunc(handler))
|
||||||
defer ln.Close()
|
defer ln.Close()
|
||||||
|
@ -1267,7 +1266,7 @@ func TestClient_SetCloneToken(t *testing.T) {
|
||||||
func TestClientWithNamespace(t *testing.T) {
|
func TestClientWithNamespace(t *testing.T) {
|
||||||
var ns string
|
var ns string
|
||||||
handler := func(w http.ResponseWriter, req *http.Request) {
|
handler := func(w http.ResponseWriter, req *http.Request) {
|
||||||
ns = req.Header.Get(consts.NamespaceHeaderName)
|
ns = req.Header.Get(NamespaceHeaderName)
|
||||||
}
|
}
|
||||||
config, ln := testHTTPServer(t, http.HandlerFunc(handler))
|
config, ln := testHTTPServer(t, http.HandlerFunc(handler))
|
||||||
defer ln.Close()
|
defer ln.Close()
|
||||||
|
|
27
api/go.mod
27
api/go.mod
|
@ -14,8 +14,8 @@ require (
|
||||||
github.com/hashicorp/go-retryablehttp v0.6.6
|
github.com/hashicorp/go-retryablehttp v0.6.6
|
||||||
github.com/hashicorp/go-rootcerts v1.0.2
|
github.com/hashicorp/go-rootcerts v1.0.2
|
||||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6
|
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6
|
||||||
|
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2
|
||||||
github.com/hashicorp/hcl v1.0.0
|
github.com/hashicorp/hcl v1.0.0
|
||||||
github.com/hashicorp/vault/sdk v0.7.0
|
|
||||||
github.com/mitchellh/mapstructure v1.5.0
|
github.com/mitchellh/mapstructure v1.5.0
|
||||||
golang.org/x/net v0.5.0
|
golang.org/x/net v0.5.0
|
||||||
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1
|
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1
|
||||||
|
@ -23,37 +23,14 @@ require (
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/armon/go-metrics v0.3.9 // indirect
|
|
||||||
github.com/armon/go-radix v1.0.0 // indirect
|
|
||||||
github.com/fatih/color v1.7.0 // indirect
|
github.com/fatih/color v1.7.0 // indirect
|
||||||
github.com/frankban/quicktest v1.13.0 // indirect
|
github.com/google/go-cmp v0.5.7 // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
|
||||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
|
||||||
github.com/hashicorp/go-kms-wrapping/v2 v2.0.6 // indirect
|
|
||||||
github.com/hashicorp/go-plugin v1.4.5 // indirect
|
|
||||||
github.com/hashicorp/go-secure-stdlib/mlock v0.1.1 // indirect
|
|
||||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
|
|
||||||
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
|
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
|
||||||
github.com/hashicorp/go-uuid v1.0.2 // indirect
|
|
||||||
github.com/hashicorp/go-version v1.2.0 // indirect
|
|
||||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
|
||||||
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect
|
|
||||||
github.com/mattn/go-colorable v0.1.6 // indirect
|
github.com/mattn/go-colorable v0.1.6 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.12 // indirect
|
github.com/mattn/go-isatty v0.0.12 // indirect
|
||||||
github.com/mitchellh/copystructure v1.0.0 // indirect
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||||
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
|
|
||||||
github.com/mitchellh/reflectwalk v1.0.0 // indirect
|
|
||||||
github.com/oklog/run v1.0.0 // indirect
|
|
||||||
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
|
|
||||||
github.com/rogpeppe/go-internal v1.9.0 // indirect
|
|
||||||
github.com/ryanuber/go-glob v1.0.0 // indirect
|
github.com/ryanuber/go-glob v1.0.0 // indirect
|
||||||
go.uber.org/atomic v1.9.0 // indirect
|
|
||||||
golang.org/x/crypto v0.5.0 // indirect
|
golang.org/x/crypto v0.5.0 // indirect
|
||||||
golang.org/x/sys v0.4.0 // indirect
|
golang.org/x/sys v0.4.0 // indirect
|
||||||
golang.org/x/text v0.6.0 // indirect
|
golang.org/x/text v0.6.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
|
|
||||||
google.golang.org/grpc v1.41.0 // indirect
|
|
||||||
google.golang.org/protobuf v1.27.1 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
224
api/go.sum
224
api/go.sum
|
@ -1,110 +1,32 @@
|
||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
||||||
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
|
||||||
github.com/armon/go-metrics v0.3.9 h1:O2sNqxBdvq8Eq5xmzljcYzAORli6RWCvEym4cJf9m18=
|
|
||||||
github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
|
|
||||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||||
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
|
|
||||||
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
|
||||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c=
|
github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c=
|
||||||
github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
|
github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
|
||||||
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
|
|
||||||
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
|
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
|
||||||
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
|
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
|
||||||
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
|
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
|
|
||||||
github.com/frankban/quicktest v1.13.0 h1:yNZif1OkDfNoDfb9zZa9aXIpejNR4F23Wely0c+Qdqk=
|
|
||||||
github.com/frankban/quicktest v1.13.0/go.mod h1:qLE0fzW0VuyUAJgPU19zByoIr0HtCHN/r/VLSOOIySU=
|
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
|
||||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
|
||||||
github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw=
|
github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw=
|
||||||
github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
|
||||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
|
||||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
|
||||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
|
||||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
|
||||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
|
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
|
||||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||||
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
||||||
github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs=
|
github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs=
|
||||||
github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
||||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
|
||||||
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
|
|
||||||
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
|
||||||
github.com/hashicorp/go-kms-wrapping/v2 v2.0.6 h1:szfBtjzqyJ/sjOAOGM1XIGnzkLFSAbCqgrNZXBqojMY=
|
|
||||||
github.com/hashicorp/go-kms-wrapping/v2 v2.0.6/go.mod h1:sDQAfwJGv25uGPZA04x87ERglCG6avnRcBT9wYoMII8=
|
|
||||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||||
github.com/hashicorp/go-plugin v1.4.5 h1:oTE/oQR4eghggRg8VY7PAz3dr++VwDNBGCcOfIvHpBo=
|
|
||||||
github.com/hashicorp/go-plugin v1.4.5/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s=
|
|
||||||
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
|
||||||
github.com/hashicorp/go-retryablehttp v0.6.6 h1:HJunrbHTDDbBb/ay4kxa1n+dLmttUlnP3V9oNE4hmsM=
|
github.com/hashicorp/go-retryablehttp v0.6.6 h1:HJunrbHTDDbBb/ay4kxa1n+dLmttUlnP3V9oNE4hmsM=
|
||||||
github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
|
github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
|
||||||
github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
|
github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
|
||||||
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
|
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
|
||||||
github.com/hashicorp/go-secure-stdlib/mlock v0.1.1 h1:cCRo8gK7oq6A2L6LICkUZ+/a5rLiRXFMf1Qd4xSwxTc=
|
|
||||||
github.com/hashicorp/go-secure-stdlib/mlock v0.1.1/go.mod h1:zq93CJChV6L9QTfGKtfBxKqD7BqqXx5O04A/ns2p5+I=
|
|
||||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 h1:om4Al8Oy7kCm/B86rLCLah4Dt5Aa0Fr5rYBG60OzwHQ=
|
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 h1:om4Al8Oy7kCm/B86rLCLah4Dt5Aa0Fr5rYBG60OzwHQ=
|
||||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
|
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
|
||||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U=
|
github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U=
|
||||||
|
@ -112,30 +34,8 @@ github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9
|
||||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4=
|
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4=
|
||||||
github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
|
github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
|
||||||
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
|
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
|
||||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
|
||||||
github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
|
|
||||||
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
|
||||||
github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E=
|
|
||||||
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
|
||||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
|
||||||
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
|
|
||||||
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
|
||||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M=
|
|
||||||
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
|
|
||||||
github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE=
|
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
|
||||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
|
||||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
|
||||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||||
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
|
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
|
||||||
|
@ -145,163 +45,41 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
|
||||||
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
||||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
|
||||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||||
github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ=
|
|
||||||
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0=
|
|
||||||
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
|
|
||||||
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||||
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY=
|
|
||||||
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
|
||||||
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
|
|
||||||
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
|
|
||||||
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
|
|
||||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
|
||||||
github.com/pierrec/lz4 v2.5.2+incompatible h1:WCjObylUIOlKy/+7Abdn34TLIkXiA4UWUMhxq9m9ZXI=
|
|
||||||
github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
|
||||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
|
||||||
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
|
||||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
|
||||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
|
||||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
|
||||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
|
||||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
|
||||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
|
||||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
|
||||||
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
|
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
|
||||||
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
|
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
|
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
|
||||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
|
||||||
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
|
|
||||||
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
|
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
|
||||||
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
|
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
|
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
|
||||||
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
||||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
|
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
|
||||||
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI=
|
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI=
|
||||||
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
|
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
|
||||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
|
||||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
|
||||||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
|
||||||
google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E=
|
|
||||||
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
|
||||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
|
||||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
|
||||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
|
||||||
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
|
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w=
|
gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w=
|
||||||
gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
|
gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package api
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -11,7 +12,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/errwrap"
|
"github.com/hashicorp/errwrap"
|
||||||
"github.com/hashicorp/vault/sdk/helper/jsonutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -390,7 +390,9 @@ func (c *Logical) UnwrapWithContext(ctx context.Context, wrappingToken string) (
|
||||||
|
|
||||||
wrappedSecret := new(Secret)
|
wrappedSecret := new(Secret)
|
||||||
buf := bytes.NewBufferString(secret.Data["response"].(string))
|
buf := bytes.NewBufferString(secret.Data["response"].(string))
|
||||||
if err := jsonutil.DecodeJSONFromReader(buf, wrappedSecret); err != nil {
|
dec := json.NewDecoder(buf)
|
||||||
|
dec.UseNumber()
|
||||||
|
if err := dec.Decode(wrappedSecret); err != nil {
|
||||||
return nil, errwrap.Wrapf("error unmarshalling wrapped secret: {{err}}", err)
|
return nil, errwrap.Wrapf("error unmarshalling wrapped secret: {{err}}", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package api
|
||||||
|
|
||||||
|
// NOTE: this file was copied from
|
||||||
|
// https://github.com/hashicorp/vault/blob/main/sdk/helper/consts/plugin_types.go
|
||||||
|
// Any changes made should be made to both files at the same time.
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
var PluginTypes = []PluginType{
|
||||||
|
PluginTypeUnknown,
|
||||||
|
PluginTypeCredential,
|
||||||
|
PluginTypeDatabase,
|
||||||
|
PluginTypeSecrets,
|
||||||
|
}
|
||||||
|
|
||||||
|
type PluginType uint32
|
||||||
|
|
||||||
|
// This is a list of PluginTypes used by Vault.
|
||||||
|
// If we need to add any in the future, it would
|
||||||
|
// be best to add them to the _end_ of the list below
|
||||||
|
// because they resolve to incrementing numbers,
|
||||||
|
// which may be saved in state somewhere. Thus if
|
||||||
|
// the name for one of those numbers changed because
|
||||||
|
// a value were added to the middle, that could cause
|
||||||
|
// the wrong plugin types to be read from storage
|
||||||
|
// for a given underlying number. Example of the problem
|
||||||
|
// here: https://play.golang.org/p/YAaPw5ww3er
|
||||||
|
const (
|
||||||
|
PluginTypeUnknown PluginType = iota
|
||||||
|
PluginTypeCredential
|
||||||
|
PluginTypeDatabase
|
||||||
|
PluginTypeSecrets
|
||||||
|
)
|
||||||
|
|
||||||
|
func (p PluginType) String() string {
|
||||||
|
switch p {
|
||||||
|
case PluginTypeUnknown:
|
||||||
|
return "unknown"
|
||||||
|
case PluginTypeCredential:
|
||||||
|
return "auth"
|
||||||
|
case PluginTypeDatabase:
|
||||||
|
return "database"
|
||||||
|
case PluginTypeSecrets:
|
||||||
|
return "secret"
|
||||||
|
default:
|
||||||
|
return "unsupported"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ParsePluginType(pluginType string) (PluginType, error) {
|
||||||
|
switch pluginType {
|
||||||
|
case "unknown":
|
||||||
|
return PluginTypeUnknown, nil
|
||||||
|
case "auth":
|
||||||
|
return PluginTypeCredential, nil
|
||||||
|
case "database":
|
||||||
|
return PluginTypeDatabase, nil
|
||||||
|
case "secret":
|
||||||
|
return PluginTypeSecrets, nil
|
||||||
|
default:
|
||||||
|
return PluginTypeUnknown, fmt.Errorf("%q is not a supported plugin type", pluginType)
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,8 +8,6 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
|
|
||||||
retryablehttp "github.com/hashicorp/go-retryablehttp"
|
retryablehttp "github.com/hashicorp/go-retryablehttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -127,7 +125,7 @@ func (r *Request) toRetryableHTTP() (*retryablehttp.Request, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(r.ClientToken) != 0 {
|
if len(r.ClientToken) != 0 {
|
||||||
req.Header.Set(consts.AuthHeaderName, r.ClientToken)
|
req.Header.Set(AuthHeaderName, r.ClientToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(r.WrapTTL) != 0 {
|
if len(r.WrapTTL) != 0 {
|
||||||
|
|
|
@ -2,13 +2,11 @@ package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/hashicorp/vault/sdk/helper/jsonutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Response is a raw response that wraps an HTTP response.
|
// Response is a raw response that wraps an HTTP response.
|
||||||
|
@ -20,7 +18,9 @@ type Response struct {
|
||||||
// will consume the response body, but will not close it. Close must
|
// will consume the response body, but will not close it. Close must
|
||||||
// still be called.
|
// still be called.
|
||||||
func (r *Response) DecodeJSON(out interface{}) error {
|
func (r *Response) DecodeJSON(out interface{}) error {
|
||||||
return jsonutil.DecodeJSONFromReader(r.Body, out)
|
dec := json.NewDecoder(r.Body)
|
||||||
|
dec.UseNumber()
|
||||||
|
return dec.Decode(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error returns an error response if there is one. If there is an error,
|
// Error returns an error response if there is one. If there is an error,
|
||||||
|
@ -42,7 +42,7 @@ func (r *Response) Error() error {
|
||||||
|
|
||||||
r.Body.Close()
|
r.Body.Close()
|
||||||
r.Body = ioutil.NopCloser(bodyBuf)
|
r.Body = ioutil.NopCloser(bodyBuf)
|
||||||
ns := r.Header.Get(consts.NamespaceHeaderName)
|
ns := r.Header.Get(NamespaceHeaderName)
|
||||||
|
|
||||||
// Build up the error object
|
// Build up the error object
|
||||||
respErr := &ResponseError{
|
respErr := &ResponseError{
|
||||||
|
@ -56,7 +56,9 @@ func (r *Response) Error() error {
|
||||||
// in a bytes.Reader here so that the JSON decoder doesn't move the
|
// in a bytes.Reader here so that the JSON decoder doesn't move the
|
||||||
// read pointer for the original buffer.
|
// read pointer for the original buffer.
|
||||||
var resp ErrorResponse
|
var resp ErrorResponse
|
||||||
if err := jsonutil.DecodeJSON(bodyBuf.Bytes(), &resp); err != nil {
|
dec := json.NewDecoder(bytes.NewReader(bodyBuf.Bytes()))
|
||||||
|
dec.UseNumber()
|
||||||
|
if err := dec.Decode(&resp); err != nil {
|
||||||
// Store the fact that we couldn't decode the errors
|
// Store the fact that we couldn't decode the errors
|
||||||
respErr.RawError = true
|
respErr.RawError = true
|
||||||
respErr.Errors = []string{bodyBuf.String()}
|
respErr.Errors = []string{bodyBuf.String()}
|
||||||
|
|
|
@ -11,8 +11,6 @@ import (
|
||||||
|
|
||||||
"github.com/hashicorp/errwrap"
|
"github.com/hashicorp/errwrap"
|
||||||
"github.com/hashicorp/go-secure-stdlib/parseutil"
|
"github.com/hashicorp/go-secure-stdlib/parseutil"
|
||||||
"github.com/hashicorp/vault/sdk/helper/jsonutil"
|
|
||||||
"github.com/hashicorp/vault/sdk/logical"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Secret is the structure returned for every secret within Vault.
|
// Secret is the structure returned for every secret within Vault.
|
||||||
|
@ -283,6 +281,22 @@ type SecretWrapInfo struct {
|
||||||
WrappedAccessor string `json:"wrapped_accessor"`
|
WrappedAccessor string `json:"wrapped_accessor"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MFAMethodID struct {
|
||||||
|
Type string `json:"type,omitempty"`
|
||||||
|
ID string `json:"id,omitempty"`
|
||||||
|
UsesPasscode bool `json:"uses_passcode,omitempty"`
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MFAConstraintAny struct {
|
||||||
|
Any []*MFAMethodID `json:"any,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MFARequirement struct {
|
||||||
|
MFARequestID string `json:"mfa_request_id,omitempty"`
|
||||||
|
MFAConstraints map[string]*MFAConstraintAny `json:"mfa_constraints,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// SecretAuth is the structure containing auth information if we have it.
|
// SecretAuth is the structure containing auth information if we have it.
|
||||||
type SecretAuth struct {
|
type SecretAuth struct {
|
||||||
ClientToken string `json:"client_token"`
|
ClientToken string `json:"client_token"`
|
||||||
|
@ -297,7 +311,7 @@ type SecretAuth struct {
|
||||||
LeaseDuration int `json:"lease_duration"`
|
LeaseDuration int `json:"lease_duration"`
|
||||||
Renewable bool `json:"renewable"`
|
Renewable bool `json:"renewable"`
|
||||||
|
|
||||||
MFARequirement *logical.MFARequirement `json:"mfa_requirement"`
|
MFARequirement *MFARequirement `json:"mfa_requirement"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseSecret is used to parse a secret value from JSON from an io.Reader.
|
// ParseSecret is used to parse a secret value from JSON from an io.Reader.
|
||||||
|
@ -323,14 +337,18 @@ func ParseSecret(r io.Reader) (*Secret, error) {
|
||||||
|
|
||||||
// First decode the JSON into a map[string]interface{}
|
// First decode the JSON into a map[string]interface{}
|
||||||
var secret Secret
|
var secret Secret
|
||||||
if err := jsonutil.DecodeJSONFromReader(&buf, &secret); err != nil {
|
dec := json.NewDecoder(&buf)
|
||||||
|
dec.UseNumber()
|
||||||
|
if err := dec.Decode(&secret); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the secret is null, add raw data to secret data if present
|
// If the secret is null, add raw data to secret data if present
|
||||||
if reflect.DeepEqual(secret, Secret{}) {
|
if reflect.DeepEqual(secret, Secret{}) {
|
||||||
data := make(map[string]interface{})
|
data := make(map[string]interface{})
|
||||||
if err := jsonutil.DecodeJSONFromReader(&teebuf, &data); err != nil {
|
dec := json.NewDecoder(&teebuf)
|
||||||
|
dec.UseNumber()
|
||||||
|
if err := dec.Decode(&data); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
errRaw, errPresent := data["errors"]
|
errRaw, errPresent := data["errors"]
|
||||||
|
|
|
@ -15,7 +15,6 @@ import (
|
||||||
rootcerts "github.com/hashicorp/go-rootcerts"
|
rootcerts "github.com/hashicorp/go-rootcerts"
|
||||||
"github.com/hashicorp/hcl"
|
"github.com/hashicorp/hcl"
|
||||||
"github.com/hashicorp/hcl/hcl/ast"
|
"github.com/hashicorp/hcl/hcl/ast"
|
||||||
"github.com/hashicorp/vault/sdk/helper/hclutil"
|
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -169,7 +168,7 @@ func ParseSSHHelperConfig(contents string) (*SSHHelperConfig, error) {
|
||||||
"tls_skip_verify",
|
"tls_skip_verify",
|
||||||
"tls_server_name",
|
"tls_server_name",
|
||||||
}
|
}
|
||||||
if err := hclutil.CheckHCLKeys(list, valid); err != nil {
|
if err := CheckHCLKeys(list, valid); err != nil {
|
||||||
return nil, multierror.Prefix(err, "ssh_helper:")
|
return nil, multierror.Prefix(err, "ssh_helper:")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +184,33 @@ func ParseSSHHelperConfig(contents string) (*SSHHelperConfig, error) {
|
||||||
return &c, nil
|
return &c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CheckHCLKeys(node ast.Node, valid []string) error {
|
||||||
|
var list *ast.ObjectList
|
||||||
|
switch n := node.(type) {
|
||||||
|
case *ast.ObjectList:
|
||||||
|
list = n
|
||||||
|
case *ast.ObjectType:
|
||||||
|
list = n.List
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("cannot check HCL keys of type %T", n)
|
||||||
|
}
|
||||||
|
|
||||||
|
validMap := make(map[string]struct{}, len(valid))
|
||||||
|
for _, v := range valid {
|
||||||
|
validMap[v] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
var result error
|
||||||
|
for _, item := range list.Items {
|
||||||
|
key := item.Keys[0].Token.Value().(string)
|
||||||
|
if _, ok := validMap[key]; !ok {
|
||||||
|
result = multierror.Append(result, fmt.Errorf("invalid key %q on line %d", key, item.Assign.Line))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
// SSHHelper creates an SSHHelper object which can talk to Vault server with SSH backend
|
// SSHHelper creates an SSHHelper object which can talk to Vault server with SSH backend
|
||||||
// mounted at default path ("ssh").
|
// mounted at default path ("ssh").
|
||||||
func (c *Client) SSHHelper() *SSHHelper {
|
func (c *Client) SSHHelper() *SSHHelper {
|
||||||
|
|
|
@ -5,8 +5,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/sdk/helper/logging"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Monitor returns a channel that outputs strings containing the log messages
|
// Monitor returns a channel that outputs strings containing the log messages
|
||||||
|
@ -20,7 +18,7 @@ func (c *Sys) Monitor(ctx context.Context, logLevel string, logFormat string) (c
|
||||||
r.Params.Add("log_level", logLevel)
|
r.Params.Add("log_level", logLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
if logFormat == "" || logFormat == logging.UnspecifiedFormat.String() {
|
if logFormat == "" {
|
||||||
r.Params.Add("log_format", "standard")
|
r.Params.Add("log_format", "standard")
|
||||||
} else {
|
} else {
|
||||||
r.Params.Add("log_format", logFormat)
|
r.Params.Add("log_format", logFormat)
|
||||||
|
|
|
@ -7,20 +7,19 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListPluginsInput is used as input to the ListPlugins function.
|
// ListPluginsInput is used as input to the ListPlugins function.
|
||||||
type ListPluginsInput struct {
|
type ListPluginsInput struct {
|
||||||
// Type of the plugin. Required.
|
// Type of the plugin. Required.
|
||||||
Type consts.PluginType `json:"type"`
|
Type PluginType `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPluginsResponse is the response from the ListPlugins call.
|
// ListPluginsResponse is the response from the ListPlugins call.
|
||||||
type ListPluginsResponse struct {
|
type ListPluginsResponse struct {
|
||||||
// PluginsByType is the list of plugins by type.
|
// PluginsByType is the list of plugins by type.
|
||||||
PluginsByType map[consts.PluginType][]string `json:"types"`
|
PluginsByType map[PluginType][]string `json:"types"`
|
||||||
|
|
||||||
Details []PluginDetails `json:"details,omitempty"`
|
Details []PluginDetails `json:"details,omitempty"`
|
||||||
|
|
||||||
|
@ -68,11 +67,11 @@ func (c *Sys) ListPluginsWithContext(ctx context.Context, i *ListPluginsInput) (
|
||||||
}
|
}
|
||||||
|
|
||||||
result := &ListPluginsResponse{
|
result := &ListPluginsResponse{
|
||||||
PluginsByType: make(map[consts.PluginType][]string),
|
PluginsByType: make(map[PluginType][]string),
|
||||||
}
|
}
|
||||||
switch i.Type {
|
switch i.Type {
|
||||||
case consts.PluginTypeUnknown:
|
case PluginTypeUnknown:
|
||||||
for _, pluginType := range consts.PluginTypes {
|
for _, pluginType := range PluginTypes {
|
||||||
pluginsRaw, ok := secret.Data[pluginType.String()]
|
pluginsRaw, ok := secret.Data[pluginType.String()]
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
|
@ -113,7 +112,7 @@ func (c *Sys) ListPluginsWithContext(ctx context.Context, i *ListPluginsInput) (
|
||||||
}
|
}
|
||||||
|
|
||||||
switch i.Type {
|
switch i.Type {
|
||||||
case consts.PluginTypeUnknown:
|
case PluginTypeUnknown:
|
||||||
result.Details = details
|
result.Details = details
|
||||||
default:
|
default:
|
||||||
// Filter for just the queried type.
|
// Filter for just the queried type.
|
||||||
|
@ -133,8 +132,8 @@ type GetPluginInput struct {
|
||||||
Name string `json:"-"`
|
Name string `json:"-"`
|
||||||
|
|
||||||
// Type of the plugin. Required.
|
// Type of the plugin. Required.
|
||||||
Type consts.PluginType `json:"type"`
|
Type PluginType `json:"type"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPluginResponse is the response from the GetPlugin call.
|
// GetPluginResponse is the response from the GetPlugin call.
|
||||||
|
@ -186,7 +185,7 @@ type RegisterPluginInput struct {
|
||||||
Name string `json:"-"`
|
Name string `json:"-"`
|
||||||
|
|
||||||
// Type of the plugin. Required.
|
// Type of the plugin. Required.
|
||||||
Type consts.PluginType `json:"type"`
|
Type PluginType `json:"type"`
|
||||||
|
|
||||||
// Args is the list of args to spawn the process with.
|
// Args is the list of args to spawn the process with.
|
||||||
Args []string `json:"args,omitempty"`
|
Args []string `json:"args,omitempty"`
|
||||||
|
@ -231,7 +230,7 @@ type DeregisterPluginInput struct {
|
||||||
Name string `json:"-"`
|
Name string `json:"-"`
|
||||||
|
|
||||||
// Type of the plugin. Required.
|
// Type of the plugin. Required.
|
||||||
Type consts.PluginType `json:"type"`
|
Type PluginType `json:"type"`
|
||||||
|
|
||||||
// Version of the plugin. Optional.
|
// Version of the plugin. Optional.
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
|
@ -368,11 +367,11 @@ func (c *Sys) ReloadPluginStatusWithContext(ctx context.Context, reloadStatusInp
|
||||||
}
|
}
|
||||||
|
|
||||||
// catalogPathByType is a helper to construct the proper API path by plugin type
|
// catalogPathByType is a helper to construct the proper API path by plugin type
|
||||||
func catalogPathByType(pluginType consts.PluginType, name string) string {
|
func catalogPathByType(pluginType PluginType, name string) string {
|
||||||
path := fmt.Sprintf("/v1/sys/plugins/catalog/%s/%s", pluginType, name)
|
path := fmt.Sprintf("/v1/sys/plugins/catalog/%s/%s", pluginType, name)
|
||||||
|
|
||||||
// Backwards compat, if type is not provided then use old path
|
// Backwards compat, if type is not provided then use old path
|
||||||
if pluginType == consts.PluginTypeUnknown {
|
if pluginType == PluginTypeUnknown {
|
||||||
path = fmt.Sprintf("/v1/sys/plugins/catalog/%s", name)
|
path = fmt.Sprintf("/v1/sys/plugins/catalog/%s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
"github.com/hashicorp/go-secure-stdlib/strutil"
|
||||||
"github.com/hashicorp/vault/sdk/helper/strutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRegisterPlugin(t *testing.T) {
|
func TestRegisterPlugin(t *testing.T) {
|
||||||
|
@ -43,32 +42,32 @@ func TestListPlugins(t *testing.T) {
|
||||||
|
|
||||||
for name, tc := range map[string]struct {
|
for name, tc := range map[string]struct {
|
||||||
input ListPluginsInput
|
input ListPluginsInput
|
||||||
expectedPlugins map[consts.PluginType][]string
|
expectedPlugins map[PluginType][]string
|
||||||
}{
|
}{
|
||||||
"no type specified": {
|
"no type specified": {
|
||||||
input: ListPluginsInput{},
|
input: ListPluginsInput{},
|
||||||
expectedPlugins: map[consts.PluginType][]string{
|
expectedPlugins: map[PluginType][]string{
|
||||||
consts.PluginTypeCredential: {"alicloud"},
|
PluginTypeCredential: {"alicloud"},
|
||||||
consts.PluginTypeDatabase: {"cassandra-database-plugin"},
|
PluginTypeDatabase: {"cassandra-database-plugin"},
|
||||||
consts.PluginTypeSecrets: {"ad", "alicloud"},
|
PluginTypeSecrets: {"ad", "alicloud"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"only auth plugins": {
|
"only auth plugins": {
|
||||||
input: ListPluginsInput{Type: consts.PluginTypeCredential},
|
input: ListPluginsInput{Type: PluginTypeCredential},
|
||||||
expectedPlugins: map[consts.PluginType][]string{
|
expectedPlugins: map[PluginType][]string{
|
||||||
consts.PluginTypeCredential: {"alicloud"},
|
PluginTypeCredential: {"alicloud"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"only database plugins": {
|
"only database plugins": {
|
||||||
input: ListPluginsInput{Type: consts.PluginTypeDatabase},
|
input: ListPluginsInput{Type: PluginTypeDatabase},
|
||||||
expectedPlugins: map[consts.PluginType][]string{
|
expectedPlugins: map[PluginType][]string{
|
||||||
consts.PluginTypeDatabase: {"cassandra-database-plugin"},
|
PluginTypeDatabase: {"cassandra-database-plugin"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"only secret plugins": {
|
"only secret plugins": {
|
||||||
input: ListPluginsInput{Type: consts.PluginTypeSecrets},
|
input: ListPluginsInput{Type: PluginTypeSecrets},
|
||||||
expectedPlugins: map[consts.PluginType][]string{
|
expectedPlugins: map[PluginType][]string{
|
||||||
consts.PluginTypeSecrets: {"ad", "alicloud"},
|
PluginTypeSecrets: {"ad", "alicloud"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
|
@ -104,7 +103,7 @@ func TestListPlugins(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, actual := range resp.Details {
|
for _, actual := range resp.Details {
|
||||||
pluginType, err := consts.ParsePluginType(actual.Type)
|
pluginType, err := ParsePluginType(actual.Type)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -173,7 +172,7 @@ func TestGetPlugin(t *testing.T) {
|
||||||
|
|
||||||
input := GetPluginInput{
|
input := GetPluginInput{
|
||||||
Name: "azure",
|
Name: "azure",
|
||||||
Type: consts.PluginTypeSecrets,
|
Type: PluginTypeSecrets,
|
||||||
}
|
}
|
||||||
if tc.version != "" {
|
if tc.version != "" {
|
||||||
input.Version = tc.version
|
input.Version = tc.version
|
||||||
|
|
|
@ -16,7 +16,7 @@ func TestAccBackend_stepwise_UserCrud(t *testing.T) {
|
||||||
customPluginName := "my-userpass"
|
customPluginName := "my-userpass"
|
||||||
envOptions := &stepwise.MountOptions{
|
envOptions := &stepwise.MountOptions{
|
||||||
RegistryName: customPluginName,
|
RegistryName: customPluginName,
|
||||||
PluginType: stepwise.PluginTypeCredential,
|
PluginType: api.PluginTypeCredential,
|
||||||
PluginName: "userpass",
|
PluginName: "userpass",
|
||||||
MountPathPrefix: customPluginName,
|
MountPathPrefix: customPluginName,
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ func TestAccBackend_Stepwise_basic(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
envOptions := &stepwise.MountOptions{
|
envOptions := &stepwise.MountOptions{
|
||||||
RegistryName: "aws-sec",
|
RegistryName: "aws-sec",
|
||||||
PluginType: stepwise.PluginTypeSecrets,
|
PluginType: api.PluginTypeSecrets,
|
||||||
PluginName: "aws",
|
PluginName: "aws",
|
||||||
MountPathPrefix: "aws-sec",
|
MountPathPrefix: "aws-sec",
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ func TestAccBackend_basic_docker(t *testing.T) {
|
||||||
decryptData := make(map[string]interface{})
|
decryptData := make(map[string]interface{})
|
||||||
envOptions := stepwise.MountOptions{
|
envOptions := stepwise.MountOptions{
|
||||||
RegistryName: "updatedtransit",
|
RegistryName: "updatedtransit",
|
||||||
PluginType: stepwise.PluginTypeSecrets,
|
PluginType: api.PluginTypeSecrets,
|
||||||
PluginName: "transit",
|
PluginName: "transit",
|
||||||
MountPathPrefix: "transit_temp",
|
MountPathPrefix: "transit_temp",
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:improvement
|
||||||
|
api: Remove dependency on sdk module.
|
||||||
|
```
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/posener/complete"
|
"github.com/posener/complete"
|
||||||
)
|
)
|
||||||
|
@ -152,7 +151,7 @@ func (c *AuthEnableCommand) Flags() *FlagSets {
|
||||||
f.StringVar(&StringVar{
|
f.StringVar(&StringVar{
|
||||||
Name: "plugin-name",
|
Name: "plugin-name",
|
||||||
Target: &c.flagPluginName,
|
Target: &c.flagPluginName,
|
||||||
Completion: c.PredictVaultPlugins(consts.PluginTypeCredential),
|
Completion: c.PredictVaultPlugins(api.PluginTypeCredential),
|
||||||
Usage: "Name of the auth method plugin. This plugin name must already " +
|
Usage: "Name of the auth method plugin. This plugin name must already " +
|
||||||
"exist in the Vault server's plugin catalog.",
|
"exist in the Vault server's plugin catalog.",
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"github.com/go-test/deep"
|
"github.com/go-test/deep"
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/helper/testhelpers/corehelpers"
|
"github.com/hashicorp/vault/helper/testhelpers/corehelpers"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -105,7 +104,7 @@ func TestAuthTuneCommand_Run(t *testing.T) {
|
||||||
t.Errorf("expected %q to be %q", mountInfo.PluginVersion, exp)
|
t.Errorf("expected %q to be %q", mountInfo.PluginVersion, exp)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, version := testPluginCreateAndRegisterVersioned(t, client, pluginDir, "userpass", consts.PluginTypeCredential)
|
_, _, version := testPluginCreateAndRegisterVersioned(t, client, pluginDir, "userpass", api.PluginTypeCredential)
|
||||||
|
|
||||||
code := cmd.Run([]string{
|
code := cmd.Run([]string{
|
||||||
"-description", "new description",
|
"-description", "new description",
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/posener/complete"
|
"github.com/posener/complete"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -155,7 +154,7 @@ func (b *BaseCommand) PredictVaultAuths() complete.Predictor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PredictVaultPlugins returns a predictor for installed plugins.
|
// PredictVaultPlugins returns a predictor for installed plugins.
|
||||||
func (b *BaseCommand) PredictVaultPlugins(pluginTypes ...consts.PluginType) complete.Predictor {
|
func (b *BaseCommand) PredictVaultPlugins(pluginTypes ...api.PluginType) complete.Predictor {
|
||||||
return NewPredict().VaultPlugins(pluginTypes...)
|
return NewPredict().VaultPlugins(pluginTypes...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +217,7 @@ func (p *Predict) VaultAuths() complete.Predictor {
|
||||||
// VaultPlugins returns a predictor for Vault's plugin catalog. This is a public
|
// VaultPlugins returns a predictor for Vault's plugin catalog. This is a public
|
||||||
// API for consumers, but you probably want BaseCommand.PredictVaultPlugins
|
// API for consumers, but you probably want BaseCommand.PredictVaultPlugins
|
||||||
// instead.
|
// instead.
|
||||||
func (p *Predict) VaultPlugins(pluginTypes ...consts.PluginType) complete.Predictor {
|
func (p *Predict) VaultPlugins(pluginTypes ...api.PluginType) complete.Predictor {
|
||||||
filterFunc := func() []string {
|
filterFunc := func() []string {
|
||||||
return p.plugins(pluginTypes...)
|
return p.plugins(pluginTypes...)
|
||||||
}
|
}
|
||||||
|
@ -395,12 +394,12 @@ func (p *Predict) auths() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// plugins returns a sorted list of the plugins in the catalog.
|
// plugins returns a sorted list of the plugins in the catalog.
|
||||||
func (p *Predict) plugins(pluginTypes ...consts.PluginType) []string {
|
func (p *Predict) plugins(pluginTypes ...api.PluginType) []string {
|
||||||
// This method's signature doesn't enforce that a pluginType must be passed in.
|
// This method's signature doesn't enforce that a pluginType must be passed in.
|
||||||
// If it's not, it's likely the caller's intent is go get a list of all of them,
|
// If it's not, it's likely the caller's intent is go get a list of all of them,
|
||||||
// so let's help them out.
|
// so let's help them out.
|
||||||
if len(pluginTypes) == 0 {
|
if len(pluginTypes) == 0 {
|
||||||
pluginTypes = append(pluginTypes, consts.PluginTypeUnknown)
|
pluginTypes = append(pluginTypes, api.PluginTypeUnknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
client := p.Client()
|
client := p.Client()
|
||||||
|
@ -411,7 +410,7 @@ func (p *Predict) plugins(pluginTypes ...consts.PluginType) []string {
|
||||||
var plugins []string
|
var plugins []string
|
||||||
pluginsAdded := make(map[string]bool)
|
pluginsAdded := make(map[string]bool)
|
||||||
for _, pluginType := range pluginTypes {
|
for _, pluginType := range pluginTypes {
|
||||||
result, err := client.Sys().ListPlugins(&api.ListPluginsInput{Type: pluginType})
|
result, err := client.Sys().ListPlugins(&api.ListPluginsInput{Type: api.PluginType(pluginType)})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/helper/testhelpers"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -72,14 +71,11 @@ func TestMonitorCommand_Run(t *testing.T) {
|
||||||
cmd.client = client
|
cmd.client = client
|
||||||
cmd.ShutdownCh = shutdownCh
|
cmd.ShutdownCh = shutdownCh
|
||||||
|
|
||||||
stopCh := testhelpers.GenerateDebugLogs(t, client)
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
atomic.StoreInt64(&code, int64(cmd.Run(tc.args)))
|
atomic.StoreInt64(&code, int64(cmd.Run(tc.args)))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
<-time.After(3 * time.Second)
|
<-time.After(3 * time.Second)
|
||||||
stopCh <- struct{}{}
|
|
||||||
close(shutdownCh)
|
close(shutdownCh)
|
||||||
|
|
||||||
if atomic.LoadInt64(&code) != tc.code {
|
if atomic.LoadInt64(&code) != tc.code {
|
||||||
|
@ -90,8 +86,6 @@ func TestMonitorCommand_Run(t *testing.T) {
|
||||||
if !strings.Contains(combined, tc.out) {
|
if !strings.Contains(combined, tc.out) {
|
||||||
t.Fatalf("expected %q to contain %q", combined, tc.out)
|
t.Fatalf("expected %q to contain %q", combined, tc.out)
|
||||||
}
|
}
|
||||||
|
|
||||||
<-stopCh
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
|
|
||||||
semver "github.com/hashicorp/go-version"
|
semver "github.com/hashicorp/go-version"
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/posener/complete"
|
"github.com/posener/complete"
|
||||||
)
|
)
|
||||||
|
@ -64,7 +63,7 @@ func (c *PluginDeregisterCommand) Flags() *FlagSets {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PluginDeregisterCommand) AutocompleteArgs() complete.Predictor {
|
func (c *PluginDeregisterCommand) AutocompleteArgs() complete.Predictor {
|
||||||
return c.PredictVaultPlugins(consts.PluginTypeUnknown)
|
return c.PredictVaultPlugins(api.PluginTypeUnknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PluginDeregisterCommand) AutocompleteFlags() complete.Flags {
|
func (c *PluginDeregisterCommand) AutocompleteFlags() complete.Flags {
|
||||||
|
@ -102,7 +101,7 @@ func (c *PluginDeregisterCommand) Run(args []string) int {
|
||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginType, err := consts.ParsePluginType(strings.TrimSpace(pluginTypeRaw))
|
pluginType, err := api.ParsePluginType(strings.TrimSpace(pluginTypeRaw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(err.Error())
|
c.UI.Error(err.Error())
|
||||||
return 2
|
return 2
|
||||||
|
|
|
@ -84,14 +84,14 @@ func TestPluginDeregisterCommand_Run(t *testing.T) {
|
||||||
defer closer()
|
defer closer()
|
||||||
|
|
||||||
pluginName := "my-plugin"
|
pluginName := "my-plugin"
|
||||||
_, sha256Sum := testPluginCreateAndRegister(t, client, pluginDir, pluginName, consts.PluginTypeCredential, "")
|
_, sha256Sum := testPluginCreateAndRegister(t, client, pluginDir, pluginName, api.PluginTypeCredential, "")
|
||||||
|
|
||||||
ui, cmd := testPluginDeregisterCommand(t)
|
ui, cmd := testPluginDeregisterCommand(t)
|
||||||
cmd.client = client
|
cmd.client = client
|
||||||
|
|
||||||
if err := client.Sys().RegisterPlugin(&api.RegisterPluginInput{
|
if err := client.Sys().RegisterPlugin(&api.RegisterPluginInput{
|
||||||
Name: pluginName,
|
Name: pluginName,
|
||||||
Type: consts.PluginTypeCredential,
|
Type: api.PluginTypeCredential,
|
||||||
Command: pluginName,
|
Command: pluginName,
|
||||||
SHA256: sha256Sum,
|
SHA256: sha256Sum,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
|
@ -113,7 +113,7 @@ func TestPluginDeregisterCommand_Run(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.Sys().ListPlugins(&api.ListPluginsInput{
|
resp, err := client.Sys().ListPlugins(&api.ListPluginsInput{
|
||||||
Type: consts.PluginTypeCredential,
|
Type: api.PluginTypeCredential,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -142,7 +142,7 @@ func TestPluginDeregisterCommand_Run(t *testing.T) {
|
||||||
defer closer()
|
defer closer()
|
||||||
|
|
||||||
pluginName := "my-plugin"
|
pluginName := "my-plugin"
|
||||||
_, _, version := testPluginCreateAndRegisterVersioned(t, client, pluginDir, pluginName, consts.PluginTypeCredential)
|
_, _, version := testPluginCreateAndRegisterVersioned(t, client, pluginDir, pluginName, api.PluginTypeCredential)
|
||||||
|
|
||||||
ui, cmd := testPluginDeregisterCommand(t)
|
ui, cmd := testPluginDeregisterCommand(t)
|
||||||
cmd.client = client
|
cmd.client = client
|
||||||
|
@ -163,7 +163,7 @@ func TestPluginDeregisterCommand_Run(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.Sys().ListPlugins(&api.ListPluginsInput{
|
resp, err := client.Sys().ListPlugins(&api.ListPluginsInput{
|
||||||
Type: consts.PluginTypeUnknown,
|
Type: api.PluginTypeUnknown,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -190,7 +190,7 @@ func TestPluginDeregisterCommand_Run(t *testing.T) {
|
||||||
defer closer()
|
defer closer()
|
||||||
|
|
||||||
pluginName := "my-plugin"
|
pluginName := "my-plugin"
|
||||||
testPluginCreateAndRegisterVersioned(t, client, pluginDir, pluginName, consts.PluginTypeCredential)
|
testPluginCreateAndRegisterVersioned(t, client, pluginDir, pluginName, api.PluginTypeCredential)
|
||||||
|
|
||||||
ui, cmd := testPluginDeregisterCommand(t)
|
ui, cmd := testPluginDeregisterCommand(t)
|
||||||
cmd.client = client
|
cmd.client = client
|
||||||
|
@ -210,7 +210,7 @@ func TestPluginDeregisterCommand_Run(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.Sys().ListPlugins(&api.ListPluginsInput{
|
resp, err := client.Sys().ListPlugins(&api.ListPluginsInput{
|
||||||
Type: consts.PluginTypeUnknown,
|
Type: api.PluginTypeUnknown,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/posener/complete"
|
"github.com/posener/complete"
|
||||||
)
|
)
|
||||||
|
@ -58,7 +57,7 @@ func (c *PluginInfoCommand) Flags() *FlagSets {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PluginInfoCommand) AutocompleteArgs() complete.Predictor {
|
func (c *PluginInfoCommand) AutocompleteArgs() complete.Predictor {
|
||||||
return c.PredictVaultPlugins(consts.PluginTypeUnknown)
|
return c.PredictVaultPlugins(api.PluginTypeUnknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PluginInfoCommand) AutocompleteFlags() complete.Flags {
|
func (c *PluginInfoCommand) AutocompleteFlags() complete.Flags {
|
||||||
|
@ -98,7 +97,7 @@ func (c *PluginInfoCommand) Run(args []string) int {
|
||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginType, err := consts.ParsePluginType(strings.TrimSpace(pluginTypeRaw))
|
pluginType, err := api.ParsePluginType(strings.TrimSpace(pluginTypeRaw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(err.Error())
|
c.UI.Error(err.Error())
|
||||||
return 2
|
return 2
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/helper/testhelpers/corehelpers"
|
"github.com/hashicorp/vault/helper/testhelpers/corehelpers"
|
||||||
"github.com/hashicorp/vault/helper/versions"
|
"github.com/hashicorp/vault/helper/versions"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
"github.com/hashicorp/vault/sdk/helper/consts"
|
||||||
|
@ -38,7 +39,7 @@ func TestPluginInfoCommand_Run(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"no_plugin_exist",
|
"no_plugin_exist",
|
||||||
[]string{consts.PluginTypeCredential.String(), "not-a-real-plugin-like-ever"},
|
[]string{api.PluginTypeCredential.String(), "not-a-real-plugin-like-ever"},
|
||||||
"Error reading plugin",
|
"Error reading plugin",
|
||||||
2,
|
2,
|
||||||
},
|
},
|
||||||
|
@ -82,13 +83,13 @@ func TestPluginInfoCommand_Run(t *testing.T) {
|
||||||
defer closer()
|
defer closer()
|
||||||
|
|
||||||
pluginName := "my-plugin"
|
pluginName := "my-plugin"
|
||||||
_, sha256Sum := testPluginCreateAndRegister(t, client, pluginDir, pluginName, consts.PluginTypeCredential, "")
|
_, sha256Sum := testPluginCreateAndRegister(t, client, pluginDir, pluginName, api.PluginTypeCredential, "")
|
||||||
|
|
||||||
ui, cmd := testPluginInfoCommand(t)
|
ui, cmd := testPluginInfoCommand(t)
|
||||||
cmd.client = client
|
cmd.client = client
|
||||||
|
|
||||||
code := cmd.Run([]string{
|
code := cmd.Run([]string{
|
||||||
consts.PluginTypeCredential.String(), pluginName,
|
api.PluginTypeCredential.String(), pluginName,
|
||||||
})
|
})
|
||||||
if exp := 0; code != exp {
|
if exp := 0; code != exp {
|
||||||
t.Errorf("expected %d to be %d", code, exp)
|
t.Errorf("expected %d to be %d", code, exp)
|
||||||
|
@ -113,7 +114,7 @@ func TestPluginInfoCommand_Run(t *testing.T) {
|
||||||
defer closer()
|
defer closer()
|
||||||
|
|
||||||
const pluginName = "azure"
|
const pluginName = "azure"
|
||||||
_, sha256Sum := testPluginCreateAndRegister(t, client, pluginDir, pluginName, consts.PluginTypeCredential, "v1.0.0")
|
_, sha256Sum := testPluginCreateAndRegister(t, client, pluginDir, pluginName, api.PluginTypeCredential, "v1.0.0")
|
||||||
|
|
||||||
for name, tc := range map[string]struct {
|
for name, tc := range map[string]struct {
|
||||||
version string
|
version string
|
||||||
|
@ -128,7 +129,7 @@ func TestPluginInfoCommand_Run(t *testing.T) {
|
||||||
|
|
||||||
code := cmd.Run([]string{
|
code := cmd.Run([]string{
|
||||||
"-version=" + tc.version,
|
"-version=" + tc.version,
|
||||||
consts.PluginTypeCredential.String(), pluginName,
|
api.PluginTypeCredential.String(), pluginName,
|
||||||
})
|
})
|
||||||
|
|
||||||
combined := ui.OutputWriter.String() + ui.ErrorWriter.String()
|
combined := ui.OutputWriter.String() + ui.ErrorWriter.String()
|
||||||
|
@ -159,14 +160,14 @@ func TestPluginInfoCommand_Run(t *testing.T) {
|
||||||
defer closer()
|
defer closer()
|
||||||
|
|
||||||
pluginName := "my-plugin"
|
pluginName := "my-plugin"
|
||||||
testPluginCreateAndRegister(t, client, pluginDir, pluginName, consts.PluginTypeCredential, "")
|
testPluginCreateAndRegister(t, client, pluginDir, pluginName, api.PluginTypeCredential, "")
|
||||||
|
|
||||||
ui, cmd := testPluginInfoCommand(t)
|
ui, cmd := testPluginInfoCommand(t)
|
||||||
cmd.client = client
|
cmd.client = client
|
||||||
|
|
||||||
code := cmd.Run([]string{
|
code := cmd.Run([]string{
|
||||||
"-field", "builtin",
|
"-field", "builtin",
|
||||||
consts.PluginTypeCredential.String(), pluginName,
|
api.PluginTypeCredential.String(), pluginName,
|
||||||
})
|
})
|
||||||
if exp := 0; code != exp {
|
if exp := 0; code != exp {
|
||||||
t.Errorf("expected %d to be %d", code, exp)
|
t.Errorf("expected %d to be %d", code, exp)
|
||||||
|
@ -188,7 +189,7 @@ func TestPluginInfoCommand_Run(t *testing.T) {
|
||||||
cmd.client = client
|
cmd.client = client
|
||||||
|
|
||||||
code := cmd.Run([]string{
|
code := cmd.Run([]string{
|
||||||
consts.PluginTypeCredential.String(), "my-plugin",
|
api.PluginTypeCredential.String(), "my-plugin",
|
||||||
})
|
})
|
||||||
if exp := 2; code != exp {
|
if exp := 2; code != exp {
|
||||||
t.Errorf("expected %d to be %d", code, exp)
|
t.Errorf("expected %d to be %d", code, exp)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/posener/complete"
|
"github.com/posener/complete"
|
||||||
)
|
)
|
||||||
|
@ -90,12 +89,12 @@ func (c *PluginListCommand) Run(args []string) int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginType := consts.PluginTypeUnknown
|
pluginType := api.PluginTypeUnknown
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
pluginTypeStr := strings.TrimSpace(args[0])
|
pluginTypeStr := strings.TrimSpace(args[0])
|
||||||
if pluginTypeStr != "" {
|
if pluginTypeStr != "" {
|
||||||
var err error
|
var err error
|
||||||
pluginType, err = consts.ParsePluginType(pluginTypeStr)
|
pluginType, err = api.ParsePluginType(pluginTypeStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(fmt.Sprintf("Error parsing type: %s", err))
|
c.UI.Error(fmt.Sprintf("Error parsing type: %s", err))
|
||||||
return 2
|
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
|
var out []string
|
||||||
switch pluginType {
|
switch pluginType {
|
||||||
case consts.PluginTypeUnknown:
|
case api.PluginTypeUnknown:
|
||||||
out = []string{"Name | Type | Version"}
|
out = []string{"Name | Type | Version"}
|
||||||
for _, plugin := range plugins.Details {
|
for _, plugin := range plugins.Details {
|
||||||
out = append(out, fmt.Sprintf("%s | %s | %s", plugin.Name, plugin.Type, plugin.Version))
|
out = append(out, fmt.Sprintf("%s | %s | %s", plugin.Name, plugin.Type, plugin.Version))
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/posener/complete"
|
"github.com/posener/complete"
|
||||||
)
|
)
|
||||||
|
@ -92,7 +91,7 @@ func (c *PluginRegisterCommand) Flags() *FlagSets {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PluginRegisterCommand) AutocompleteArgs() complete.Predictor {
|
func (c *PluginRegisterCommand) AutocompleteArgs() complete.Predictor {
|
||||||
return c.PredictVaultPlugins(consts.PluginTypeUnknown)
|
return c.PredictVaultPlugins(api.PluginTypeUnknown)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *PluginRegisterCommand) AutocompleteFlags() complete.Flags {
|
func (c *PluginRegisterCommand) AutocompleteFlags() complete.Flags {
|
||||||
|
@ -135,7 +134,7 @@ func (c *PluginRegisterCommand) Run(args []string) int {
|
||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginType, err := consts.ParsePluginType(strings.TrimSpace(pluginTypeRaw))
|
pluginType, err := api.ParsePluginType(strings.TrimSpace(pluginTypeRaw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(err.Error())
|
c.UI.Error(err.Error())
|
||||||
return 2
|
return 2
|
||||||
|
|
|
@ -107,7 +107,7 @@ func TestPluginRegisterCommand_Run(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.Sys().ListPlugins(&api.ListPluginsInput{
|
resp, err := client.Sys().ListPlugins(&api.ListPluginsInput{
|
||||||
Type: consts.PluginTypeCredential,
|
Type: api.PluginTypeCredential,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -138,7 +138,7 @@ func TestPluginRegisterCommand_Run(t *testing.T) {
|
||||||
const pluginName = "my-plugin"
|
const pluginName = "my-plugin"
|
||||||
versions := []string{"v1.0.0", "v2.0.1"}
|
versions := []string{"v1.0.0", "v2.0.1"}
|
||||||
_, sha256Sum := testPluginCreate(t, pluginDir, pluginName)
|
_, sha256Sum := testPluginCreate(t, pluginDir, pluginName)
|
||||||
types := []consts.PluginType{consts.PluginTypeCredential, consts.PluginTypeDatabase, consts.PluginTypeSecrets}
|
types := []api.PluginType{api.PluginTypeCredential, api.PluginTypeDatabase, api.PluginTypeSecrets}
|
||||||
|
|
||||||
for _, typ := range types {
|
for _, typ := range types {
|
||||||
for _, version := range versions {
|
for _, version := range versions {
|
||||||
|
@ -164,17 +164,17 @@ func TestPluginRegisterCommand_Run(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.Sys().ListPlugins(&api.ListPluginsInput{
|
resp, err := client.Sys().ListPlugins(&api.ListPluginsInput{
|
||||||
Type: consts.PluginTypeUnknown,
|
Type: api.PluginTypeUnknown,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
found := make(map[consts.PluginType]int)
|
found := make(map[api.PluginType]int)
|
||||||
versionsFound := make(map[consts.PluginType][]string)
|
versionsFound := make(map[api.PluginType][]string)
|
||||||
for _, p := range resp.Details {
|
for _, p := range resp.Details {
|
||||||
if p.Name == pluginName {
|
if p.Name == pluginName {
|
||||||
typ, err := consts.ParsePluginType(p.Type)
|
typ, err := api.ParsePluginType(p.Type)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
|
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/helper/testhelpers/corehelpers"
|
"github.com/hashicorp/vault/helper/testhelpers/corehelpers"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -90,14 +89,14 @@ func TestPluginReloadCommand_Run(t *testing.T) {
|
||||||
defer closer()
|
defer closer()
|
||||||
|
|
||||||
pluginName := "my-plugin"
|
pluginName := "my-plugin"
|
||||||
_, sha256Sum := testPluginCreateAndRegister(t, client, pluginDir, pluginName, consts.PluginTypeCredential, "")
|
_, sha256Sum := testPluginCreateAndRegister(t, client, pluginDir, pluginName, api.PluginTypeCredential, "")
|
||||||
|
|
||||||
ui, cmd := testPluginReloadCommand(t)
|
ui, cmd := testPluginReloadCommand(t)
|
||||||
cmd.client = client
|
cmd.client = client
|
||||||
|
|
||||||
if err := client.Sys().RegisterPlugin(&api.RegisterPluginInput{
|
if err := client.Sys().RegisterPlugin(&api.RegisterPluginInput{
|
||||||
Name: pluginName,
|
Name: pluginName,
|
||||||
Type: consts.PluginTypeCredential,
|
Type: api.PluginTypeCredential,
|
||||||
Command: pluginName,
|
Command: pluginName,
|
||||||
SHA256: sha256Sum,
|
SHA256: sha256Sum,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// testPluginCreate creates a sample plugin in a tempdir and returns the shasum
|
// testPluginCreate creates a sample plugin in a tempdir and returns the shasum
|
||||||
|
@ -38,7 +37,7 @@ func testPluginCreate(tb testing.TB, dir, name string) (string, string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// testPluginCreateAndRegister creates a plugin and registers it in the catalog.
|
// testPluginCreateAndRegister creates a plugin and registers it in the catalog.
|
||||||
func testPluginCreateAndRegister(tb testing.TB, client *api.Client, dir, name string, pluginType consts.PluginType, version string) (string, string) {
|
func testPluginCreateAndRegister(tb testing.TB, client *api.Client, dir, name string, pluginType api.PluginType, version string) (string, string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
|
|
||||||
pth, sha256Sum := testPluginCreate(tb, dir, name)
|
pth, sha256Sum := testPluginCreate(tb, dir, name)
|
||||||
|
@ -57,7 +56,7 @@ func testPluginCreateAndRegister(tb testing.TB, client *api.Client, dir, name st
|
||||||
}
|
}
|
||||||
|
|
||||||
// testPluginCreateAndRegisterVersioned creates a versioned plugin and registers it in the catalog.
|
// testPluginCreateAndRegisterVersioned creates a versioned plugin and registers it in the catalog.
|
||||||
func testPluginCreateAndRegisterVersioned(tb testing.TB, client *api.Client, dir, name string, pluginType consts.PluginType) (string, string, string) {
|
func testPluginCreateAndRegisterVersioned(tb testing.TB, client *api.Client, dir, name string, pluginType api.PluginType) (string, string, string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
|
|
||||||
pth, sha256Sum := testPluginCreate(tb, dir, name)
|
pth, sha256Sum := testPluginCreate(tb, dir, name)
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/posener/complete"
|
"github.com/posener/complete"
|
||||||
)
|
)
|
||||||
|
@ -169,7 +168,7 @@ func (c *SecretsEnableCommand) Flags() *FlagSets {
|
||||||
f.StringVar(&StringVar{
|
f.StringVar(&StringVar{
|
||||||
Name: "plugin-name",
|
Name: "plugin-name",
|
||||||
Target: &c.flagPluginName,
|
Target: &c.flagPluginName,
|
||||||
Completion: c.PredictVaultPlugins(consts.PluginTypeSecrets, consts.PluginTypeDatabase),
|
Completion: c.PredictVaultPlugins(api.PluginTypeSecrets, api.PluginTypeDatabase),
|
||||||
Usage: "Name of the secrets engine plugin. This plugin name must already " +
|
Usage: "Name of the secrets engine plugin. This plugin name must already " +
|
||||||
"exist in Vault's plugin catalog.",
|
"exist in Vault's plugin catalog.",
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"github.com/go-test/deep"
|
"github.com/go-test/deep"
|
||||||
"github.com/hashicorp/vault/api"
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/helper/testhelpers/corehelpers"
|
"github.com/hashicorp/vault/helper/testhelpers/corehelpers"
|
||||||
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -179,7 +178,7 @@ func TestSecretsTuneCommand_Run(t *testing.T) {
|
||||||
t.Errorf("expected %q to be %q", mountInfo.PluginVersion, exp)
|
t.Errorf("expected %q to be %q", mountInfo.PluginVersion, exp)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, version := testPluginCreateAndRegisterVersioned(t, client, pluginDir, "pki", consts.PluginTypeSecrets)
|
_, _, version := testPluginCreateAndRegisterVersioned(t, client, pluginDir, "pki", api.PluginTypeSecrets)
|
||||||
|
|
||||||
code := cmd.Run([]string{
|
code := cmd.Run([]string{
|
||||||
"-description", "new description",
|
"-description", "new description",
|
||||||
|
|
4
go.mod
4
go.mod
|
@ -134,8 +134,8 @@ require (
|
||||||
github.com/hashicorp/vault-plugin-secrets-mongodbatlas v0.8.0
|
github.com/hashicorp/vault-plugin-secrets-mongodbatlas v0.8.0
|
||||||
github.com/hashicorp/vault-plugin-secrets-openldap v0.9.0
|
github.com/hashicorp/vault-plugin-secrets-openldap v0.9.0
|
||||||
github.com/hashicorp/vault-plugin-secrets-terraform v0.6.0
|
github.com/hashicorp/vault-plugin-secrets-terraform v0.6.0
|
||||||
github.com/hashicorp/vault-testing-stepwise v0.1.2
|
github.com/hashicorp/vault-testing-stepwise v0.1.3-0.20230203193428-3a789cb2c68f
|
||||||
github.com/hashicorp/vault/api v1.8.3
|
github.com/hashicorp/vault/api v1.8.4-0.20230203172428-594f24d11fa0
|
||||||
github.com/hashicorp/vault/api/auth/approle v0.1.0
|
github.com/hashicorp/vault/api/auth/approle v0.1.0
|
||||||
github.com/hashicorp/vault/api/auth/userpass v0.1.0
|
github.com/hashicorp/vault/api/auth/userpass v0.1.0
|
||||||
github.com/hashicorp/vault/sdk v0.7.0
|
github.com/hashicorp/vault/sdk v0.7.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1177,6 +1177,10 @@ github.com/hashicorp/vault-plugin-secrets-terraform v0.6.0/go.mod h1:GzYAJYytgbN
|
||||||
github.com/hashicorp/vault-testing-stepwise v0.1.1/go.mod h1:3vUYn6D0ZadvstNO3YQQlIcp7u1a19MdoOC0NQ0yaOE=
|
github.com/hashicorp/vault-testing-stepwise v0.1.1/go.mod h1:3vUYn6D0ZadvstNO3YQQlIcp7u1a19MdoOC0NQ0yaOE=
|
||||||
github.com/hashicorp/vault-testing-stepwise v0.1.2 h1:3obC/ziAPGnsz2IQxr5e4Ayb7tu7WL6pm6mmZ5gwhhs=
|
github.com/hashicorp/vault-testing-stepwise v0.1.2 h1:3obC/ziAPGnsz2IQxr5e4Ayb7tu7WL6pm6mmZ5gwhhs=
|
||||||
github.com/hashicorp/vault-testing-stepwise v0.1.2/go.mod h1:TeU6B+5NqxUjto+Zey+QQEH1iywuHn0ciHZNYh4q3uI=
|
github.com/hashicorp/vault-testing-stepwise v0.1.2/go.mod h1:TeU6B+5NqxUjto+Zey+QQEH1iywuHn0ciHZNYh4q3uI=
|
||||||
|
github.com/hashicorp/vault-testing-stepwise v0.1.3-0.20230203181409-3a889bf3fcb0 h1:QVL9Q+yya4rtdumOWGUR4bYBCOkVE3heaUZGQfs48YM=
|
||||||
|
github.com/hashicorp/vault-testing-stepwise v0.1.3-0.20230203181409-3a889bf3fcb0/go.mod h1:8zCPiYcaasC/X/OR+NjbvaO48k1enp+WfhiJLJ/rkJ8=
|
||||||
|
github.com/hashicorp/vault-testing-stepwise v0.1.3-0.20230203193428-3a789cb2c68f h1:7ASzAq/gPihP/HAd8RmS9c7LiJtDMnjkPbfWKhm/XiI=
|
||||||
|
github.com/hashicorp/vault-testing-stepwise v0.1.3-0.20230203193428-3a789cb2c68f/go.mod h1:8zCPiYcaasC/X/OR+NjbvaO48k1enp+WfhiJLJ/rkJ8=
|
||||||
github.com/hashicorp/vault/vault/hcp_link/proto v0.0.0-20230201201504-b741fa893d77 h1:Y/+BtwxmRak3Us9jrByARvYW6uNeqZlEpMylIdXVIjY=
|
github.com/hashicorp/vault/vault/hcp_link/proto v0.0.0-20230201201504-b741fa893d77 h1:Y/+BtwxmRak3Us9jrByARvYW6uNeqZlEpMylIdXVIjY=
|
||||||
github.com/hashicorp/vault/vault/hcp_link/proto v0.0.0-20230201201504-b741fa893d77/go.mod h1:a2crHoMWwY6aiL8GWT8hYj7vKD64uX0EdRPbnsHF5wU=
|
github.com/hashicorp/vault/vault/hcp_link/proto v0.0.0-20230201201504-b741fa893d77/go.mod h1:a2crHoMWwY6aiL8GWT8hYj7vKD64uX0EdRPbnsHF5wU=
|
||||||
github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443 h1:O/pT5C1Q3mVXMyuqg7yuAWUg/jMZR1/0QTzTRdNR6Uw=
|
github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443 h1:O/pT5C1Q3mVXMyuqg7yuAWUg/jMZR1/0QTzTRdNR6Uw=
|
||||||
|
|
|
@ -596,18 +596,16 @@ func GenerateDebugLogs(t testing.T, client *api.Client) chan struct{} {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
stopCh := make(chan struct{})
|
stopCh := make(chan struct{})
|
||||||
ticker := time.NewTicker(time.Second)
|
|
||||||
var err error
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
ticker := time.NewTicker(time.Second)
|
||||||
|
defer ticker.Stop()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-stopCh:
|
case <-stopCh:
|
||||||
ticker.Stop()
|
|
||||||
stopCh <- struct{}{}
|
|
||||||
return
|
return
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
err = client.Sys().Mount("foo", &api.MountInput{
|
err := client.Sys().Mount("foo", &api.MountInput{
|
||||||
Type: "kv",
|
Type: "kv",
|
||||||
Options: map[string]string{
|
Options: map[string]string{
|
||||||
"version": "1",
|
"version": "1",
|
||||||
|
|
|
@ -7,15 +7,16 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
log "github.com/hashicorp/go-hclog"
|
|
||||||
"github.com/hashicorp/vault/helper/testhelpers"
|
"github.com/hashicorp/vault/helper/testhelpers"
|
||||||
"github.com/hashicorp/vault/sdk/helper/logging"
|
|
||||||
"github.com/hashicorp/vault/vault"
|
"github.com/hashicorp/vault/vault"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSysMonitorUnknownLogLevel(t *testing.T) {
|
func TestSysMonitorUnknownLogLevel(t *testing.T) {
|
||||||
cluster := vault.NewTestCluster(t, nil, &vault.TestClusterOptions{HandlerFunc: Handler})
|
t.Parallel()
|
||||||
cluster.Start()
|
cluster := vault.NewTestCluster(t, nil, &vault.TestClusterOptions{
|
||||||
|
HandlerFunc: Handler,
|
||||||
|
NumCores: 1,
|
||||||
|
})
|
||||||
defer cluster.Cleanup()
|
defer cluster.Cleanup()
|
||||||
|
|
||||||
client := cluster.Cores[0].Client
|
client := cluster.Cores[0].Client
|
||||||
|
@ -37,8 +38,11 @@ func TestSysMonitorUnknownLogLevel(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSysMonitorUnknownLogFormat(t *testing.T) {
|
func TestSysMonitorUnknownLogFormat(t *testing.T) {
|
||||||
cluster := vault.NewTestCluster(t, nil, &vault.TestClusterOptions{HandlerFunc: Handler})
|
t.Parallel()
|
||||||
cluster.Start()
|
cluster := vault.NewTestCluster(t, nil, &vault.TestClusterOptions{
|
||||||
|
HandlerFunc: Handler,
|
||||||
|
NumCores: 1,
|
||||||
|
})
|
||||||
defer cluster.Cleanup()
|
defer cluster.Cleanup()
|
||||||
|
|
||||||
client := cluster.Cores[0].Client
|
client := cluster.Cores[0].Client
|
||||||
|
@ -60,64 +64,61 @@ func TestSysMonitorUnknownLogFormat(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSysMonitorStreamingLogs(t *testing.T) {
|
func TestSysMonitorStreamingLogs(t *testing.T) {
|
||||||
logger := log.NewInterceptLogger(&log.LoggerOptions{
|
t.Parallel()
|
||||||
Output: log.DefaultOutput,
|
cluster := vault.NewTestCluster(t, nil, &vault.TestClusterOptions{
|
||||||
Level: log.Debug,
|
HandlerFunc: Handler,
|
||||||
JSONFormat: logging.ParseEnvLogFormat() == logging.JSONFormat,
|
NumCores: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
lf := logging.ParseEnvLogFormat().String()
|
|
||||||
|
|
||||||
cluster := vault.NewTestCluster(t, nil, &vault.TestClusterOptions{HandlerFunc: Handler, Logger: logger})
|
|
||||||
cluster.Start()
|
|
||||||
defer cluster.Cleanup()
|
defer cluster.Cleanup()
|
||||||
|
|
||||||
client := cluster.Cores[0].Client
|
client := cluster.Cores[0].Client
|
||||||
stopCh := testhelpers.GenerateDebugLogs(t, client)
|
stopCh := testhelpers.GenerateDebugLogs(t, client)
|
||||||
|
defer close(stopCh)
|
||||||
|
|
||||||
debugCount := 0
|
for _, lf := range []string{"standard", "json"} {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
|
t.Run(lf, func(t *testing.T) {
|
||||||
defer cancel()
|
debugCount := 0
|
||||||
logCh, err := client.Sys().Monitor(ctx, "DEBUG", lf)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
type jsonlog struct {
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
Level string `json:"@level"`
|
defer cancel()
|
||||||
Message string `json:"@message"`
|
|
||||||
TimeStamp string `json:"@timestamp"`
|
|
||||||
}
|
|
||||||
jsonLog := &jsonlog{}
|
|
||||||
|
|
||||||
timeCh := time.After(5 * time.Second)
|
logCh, err := client.Sys().Monitor(ctx, "DEBUG", lf)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
type jsonlog struct {
|
||||||
select {
|
Level string `json:"@level"`
|
||||||
case log := <-logCh:
|
Message string `json:"@message"`
|
||||||
if lf == "json" {
|
TimeStamp string `json:"@timestamp"`
|
||||||
err := json.Unmarshal([]byte(log), jsonLog)
|
}
|
||||||
if err != nil {
|
jsonLog := &jsonlog{}
|
||||||
t.Fatal("Expected JSON log from channel")
|
|
||||||
}
|
timeCh := time.After(5 * time.Second)
|
||||||
if strings.Contains(jsonLog.Level, "debug") {
|
|
||||||
debugCount++
|
for {
|
||||||
|
select {
|
||||||
|
case log := <-logCh:
|
||||||
|
if lf == "json" {
|
||||||
|
err := json.Unmarshal([]byte(log), jsonLog)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal("Expected JSON log from channel")
|
||||||
|
}
|
||||||
|
if strings.Contains(jsonLog.Level, "debug") {
|
||||||
|
debugCount++
|
||||||
|
}
|
||||||
|
} else if strings.Contains(log, "[DEBUG]") {
|
||||||
|
debugCount++
|
||||||
|
}
|
||||||
|
if debugCount > 3 {
|
||||||
|
// If we've seen multiple lines that match what we want,
|
||||||
|
// it's probably safe to assume streaming is working
|
||||||
|
return
|
||||||
|
}
|
||||||
|
case <-timeCh:
|
||||||
|
t.Fatal("Failed to get a DEBUG message after 5 seconds")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if strings.Contains(log, "[DEBUG]") {
|
})
|
||||||
debugCount++
|
|
||||||
}
|
|
||||||
case <-timeCh:
|
|
||||||
t.Fatal("Failed to get a DEBUG message after 5 seconds")
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we've seen multiple lines that match what we want,
|
|
||||||
// it's probably safe to assume streaming is working
|
|
||||||
if debugCount > 3 {
|
|
||||||
stopCh <- struct{}{}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<-stopCh
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package consts
|
package consts
|
||||||
|
|
||||||
|
// NOTE: this file has been copied to
|
||||||
|
// https://github.com/hashicorp/vault/blob/main/api/plugin_types.go
|
||||||
|
// Any changes made should be made to both files at the same time.
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
var PluginTypes = []PluginType{
|
var PluginTypes = []PluginType{
|
||||||
|
|
Loading…
Reference in New Issue