update loopback to normalize endpoint_url (#5603)
This commit is contained in:
4 files changed
+12
-4
No files matched your search
@@ -45,7 +45,7 @@ require (
|
||||
github.com/hashicorp/go-secure-stdlib/kv-builder v0.1.2
|
||||
github.com/hashicorp/go-secure-stdlib/listenerutil v0.1.9
|
||||
github.com/hashicorp/go-secure-stdlib/mlock v0.1.3
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0
|
||||
github.com/hashicorp/go-secure-stdlib/password v0.1.3
|
||||
github.com/hashicorp/go-secure-stdlib/permitpool v1.0.0
|
||||
github.com/hashicorp/go-secure-stdlib/pluginutil/v2 v2.0.6
|
||||
|
||||
@@ -235,8 +235,8 @@ github.com/hashicorp/go-secure-stdlib/listenerutil v0.1.9 h1:0S0ctJ7Ra8O7ap+/3fZ
|
||||
github.com/hashicorp/go-secure-stdlib/listenerutil v0.1.9/go.mod h1:TNNdgtjLgVDbrgFcyCKrlAicIl3dZF94swJltyGUX2M=
|
||||
github.com/hashicorp/go-secure-stdlib/mlock v0.1.3 h1:kH3Rhiht36xhAfhuHyWJDgdXXEx9IIZhDGRk24CDhzg=
|
||||
github.com/hashicorp/go-secure-stdlib/mlock v0.1.3/go.mod h1:ov1Q0oEDjC3+A4BwsG2YdKltrmEw8sf9Pau4V9JQ4Vo=
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 h1:iBt4Ew4XEGLfh6/bPk4rSYmuZJGizr6/x/AEizP0CQc=
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8/go.mod h1:aiJI+PIApBRQG7FZTEBx5GiiX+HbOHilUdNxUZi4eV0=
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0 h1:U+kC2dOhMFQctRfhK0gRctKAPTloZdMU5ZJxaesJ/VM=
|
||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0/go.mod h1:Ll013mhdmsVDuoIXVfBtvgGJsXDYkTw1kooNcoCXuE0=
|
||||
github.com/hashicorp/go-secure-stdlib/password v0.1.3 h1:/2S3qhBDGbI0DoSgSC8m9EaiRelgGrJmApZIDb/8Xv8=
|
||||
github.com/hashicorp/go-secure-stdlib/password v0.1.3/go.mod h1:JPOgAG+z70auO30+LCRhvZKxGAh8cfXorXNJWGlFiVQ=
|
||||
github.com/hashicorp/go-secure-stdlib/permitpool v1.0.0 h1:U6y5MXGiDVOOtkWJ6o/tu1TxABnI0yKTQWJr7z6BpNk=
|
||||
|
||||
@@ -51,6 +51,7 @@ func normalizeCatalogAttributes(ctx context.Context, plgClient plgpb.HostPluginS
|
||||
})
|
||||
switch {
|
||||
case err == nil:
|
||||
// TODO: this should be updated to return these attributes rather than updating them in-place
|
||||
if ret.Attributes != nil {
|
||||
plgHc.Attrs = &pb.HostCatalog_Attributes{
|
||||
Attributes: ret.Attributes,
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
|
||||
"github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/storagebuckets"
|
||||
plgpb "github.com/hashicorp/boundary/sdk/pbs/plugin"
|
||||
"github.com/hashicorp/go-secure-stdlib/parseutil"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
@@ -141,9 +142,15 @@ func (l *LoopbackStorage) normalizeStorageBucketData(ctx context.Context, req *p
|
||||
if req.GetAttributes() == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "%s: missing attributes", op)
|
||||
}
|
||||
attrs := req.GetAttributes()
|
||||
if endpoint, ok := attrs.GetFields()["endpoint_url"]; ok {
|
||||
if endpoint, err := parseutil.NormalizeAddr(endpoint.GetStringValue()); err == nil {
|
||||
attrs.Fields["endpoint_url"] = structpb.NewStringValue(endpoint)
|
||||
}
|
||||
}
|
||||
l.normalizations++
|
||||
return &plgpb.NormalizeStorageBucketDataResponse{
|
||||
Attributes: req.GetAttributes(),
|
||||
Attributes: attrs,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user