Browse Source

rename

pull/2211/head
Chris Lu 4 years ago
parent
commit
3d624d1e16
  1. 3
      weed/filer/s3iam_conf.go
  2. 2
      weed/filer/s3iam_conf_test.go
  3. 4
      weed/iamapi/iamapi_server.go
  4. 2
      weed/shell/command_s3_configure.go

3
weed/filer/s3iam_conf.go

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"github.com/chrislusf/seaweedfs/weed/pb/iam_pb" "github.com/chrislusf/seaweedfs/weed/pb/iam_pb"
"github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
"io" "io"
) )
@ -14,7 +15,7 @@ func ParseS3ConfigurationFromBytes(content []byte, config *iam_pb.S3ApiConfigura
return nil return nil
} }
func S3ConfigurationToText(writer io.Writer, config *iam_pb.S3ApiConfiguration) error {
func ProtoToText(writer io.Writer, config proto.Message) error {
m := jsonpb.Marshaler{ m := jsonpb.Marshaler{
EmitDefaults: false, EmitDefaults: false,

2
weed/filer/s3iam_conf_test.go

@ -44,7 +44,7 @@ func TestS3Conf(t *testing.T) {
}, },
} }
var buf bytes.Buffer var buf bytes.Buffer
err := S3ConfigurationToText(&buf, s3Conf)
err := ProtoToText(&buf, s3Conf)
assert.Equal(t, err, nil) assert.Equal(t, err, nil)
s3ConfSaved := &iam_pb.S3ApiConfiguration{} s3ConfSaved := &iam_pb.S3ApiConfiguration{}
err = ParseS3ConfigurationFromBytes(buf.Bytes(), s3ConfSaved) err = ParseS3ConfigurationFromBytes(buf.Bytes(), s3ConfSaved)

4
weed/iamapi/iamapi_server.go

@ -96,8 +96,8 @@ func (iam IamS3ApiConfigure) GetS3ApiConfiguration(s3cfg *iam_pb.S3ApiConfigurat
func (iam IamS3ApiConfigure) PutS3ApiConfiguration(s3cfg *iam_pb.S3ApiConfiguration) (err error) { func (iam IamS3ApiConfigure) PutS3ApiConfiguration(s3cfg *iam_pb.S3ApiConfiguration) (err error) {
buf := bytes.Buffer{} buf := bytes.Buffer{}
if err := filer.S3ConfigurationToText(&buf, s3cfg); err != nil {
return fmt.Errorf("S3ConfigurationToText: %s", err)
if err := filer.ProtoToText(&buf, s3cfg); err != nil {
return fmt.Errorf("ProtoToText: %s", err)
} }
return pb.WithGrpcFilerClient( return pb.WithGrpcFilerClient(
iam.option.FilerGrpcAddress, iam.option.FilerGrpcAddress,

2
weed/shell/command_s3_configure.go

@ -164,7 +164,7 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io
} }
buf.Reset() buf.Reset()
filer.S3ConfigurationToText(&buf, s3cfg)
filer.ProtoToText(&buf, s3cfg)
fmt.Fprintf(writer, string(buf.Bytes())) fmt.Fprintf(writer, string(buf.Bytes()))
fmt.Fprintln(writer) fmt.Fprintln(writer)

Loading…
Cancel
Save