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.

25 lines
527 B

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. "io"
  7. )
  8. func ParseS3ConfigurationFromBytes(content []byte, config *iam_pb.S3ApiConfiguration) error {
  9. if err := jsonpb.Unmarshal(bytes.NewBuffer(content), config); err != nil {
  10. return err
  11. }
  12. return nil
  13. }
  14. func S3ConfigurationToText(writer io.Writer, config *iam_pb.S3ApiConfiguration) error {
  15. m := jsonpb.Marshaler{
  16. EmitDefaults: false,
  17. Indent: " ",
  18. }
  19. return m.Marshal(writer, config)
  20. }