SetBucketLoggingRequestSerializer.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (C) Alibaba Cloud Computing
  3. * All rights reserved.
  4. *
  5. * 版权所有 (C)阿里云计算有限公司
  6. */
  7. using Aliyun.OSS.Model;
  8. using System.IO;
  9. namespace Aliyun.OSS.Transform
  10. {
  11. internal class SetBucketLoggingRequestSerializer : RequestSerializer<SetBucketLoggingRequest, SetBucketLoggingRequestModel>
  12. {
  13. public SetBucketLoggingRequestSerializer(ISerializer<SetBucketLoggingRequestModel, Stream> contentSerializer)
  14. : base(contentSerializer)
  15. { }
  16. public override Stream Serialize(SetBucketLoggingRequest request)
  17. {
  18. var model = new SetBucketLoggingRequestModel();
  19. var setBucketLoggingEnabled = new SetBucketLoggingRequestModel.SetBucketLoggingEnabled
  20. {
  21. TargetBucket = request.TargetBucket,
  22. TargetPrefix = request.TargetPrefix
  23. };
  24. model.LoggingEnabled = setBucketLoggingEnabled;
  25. return ContentSerializer.Serialize(model);
  26. }
  27. }
  28. }