You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
540 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. package filer
  2. import (
  3. "bytes"
  4. "github.com/chrislusf/seaweedfs/weed/pb/iam_pb"
  5. "github.com/golang/protobuf/jsonpb"
  6. "github.com/golang/protobuf/proto"
  7. "io"
  8. )
  9. func ParseS3ConfigurationFromBytes(content []byte, config *iam_pb.S3ApiConfiguration) error {
  10. if err := jsonpb.Unmarshal(bytes.NewBuffer(content), config); err != nil {
  11. return err
  12. }
  13. return nil
  14. }
  15. func ProtoToText(writer io.Writer, config proto.Message) error {
  16. m := jsonpb.Marshaler{
  17. EmitDefaults: false,
  18. Indent: " ",
  19. }
  20. return m.Marshal(writer, config)
  21. }