s3iam_conf.go 527 B

12345678910111213141516171819202122232425
  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. }