SetBucketWebsiteRequestSerializer.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132
  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 SetBucketWebsiteRequestSerializer : RequestSerializer<SetBucketWebsiteRequest, SetBucketWebsiteRequestModel>
  12. {
  13. public SetBucketWebsiteRequestSerializer(ISerializer<SetBucketWebsiteRequestModel, Stream> contentSerializer)
  14. : base(contentSerializer)
  15. { }
  16. public override Stream Serialize(SetBucketWebsiteRequest request)
  17. {
  18. var model = new SetBucketWebsiteRequestModel
  19. {
  20. ErrorDocument = new SetBucketWebsiteRequestModel.ErrorDocumentModel(),
  21. IndexDocument = new SetBucketWebsiteRequestModel.IndexDocumentModel {Suffix = request.IndexDocument}
  22. };
  23. model.ErrorDocument.Key = request.ErrorDocument;
  24. return ContentSerializer.Serialize(model);
  25. }
  26. }
  27. }