ListObjectsRequest.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Copyright (C) Alibaba Cloud Computing
  3. * All rights reserved.
  4. *
  5. * 版权所有 (C)阿里云计算有限公司
  6. */
  7. using System;
  8. using Aliyun.OSS.Util;
  9. namespace Aliyun.OSS
  10. {
  11. /// <summary>
  12. /// 包含获取<see cref="OssObjectSummary" />列表的请求信息。
  13. /// </summary>
  14. public class ListObjectsRequest
  15. {
  16. private string _prefix;
  17. private string _marker;
  18. private Int32? _maxKeys;
  19. private string _delimiter;
  20. private string _encodingType;
  21. /// <summary>
  22. /// 获取<see cref="OssObject" />所在<see cref="Bucket" />的名称。
  23. /// </summary>
  24. public string BucketName { get; private set; }
  25. /// <summary>
  26. /// 获取或设置一个值,限定返回的<see cref="OssObject" />的Key必须以该值作为前缀。
  27. /// </summary>
  28. public string Prefix
  29. {
  30. get { return _prefix; }
  31. set
  32. {
  33. if (value != null && value.Length > OssUtils.MaxPrefixStringSize)
  34. throw new ArgumentException("parameter 'prefix' exceeds max size limit.");
  35. _prefix = value;
  36. }
  37. }
  38. /// <summary>
  39. /// 获取或设置一个值,用户设定结果从该值之后按字母排序的第一个开始返回。
  40. /// </summary>
  41. public string Marker
  42. {
  43. get { return _marker; }
  44. set
  45. {
  46. if (value != null && value.Length > OssUtils.MaxMarkerStringSize)
  47. throw new ArgumentException("parameter 'marker' exceeds max size limit.");
  48. _marker = value;
  49. }
  50. }
  51. /// <summary>
  52. /// 获取或设置一个值,用于限定此次返回object的最大数。
  53. /// 如果不设定,默认为100。
  54. /// </summary>
  55. public Int32? MaxKeys
  56. {
  57. get { return _maxKeys.HasValue ? _maxKeys.Value : 100; }
  58. set
  59. {
  60. if (value > OssUtils.MaxReturnedKeys)
  61. throw new ArgumentException("parameter 'maxkeys' exceed max limit.");
  62. _maxKeys = value;
  63. }
  64. }
  65. /// <summary>
  66. /// 获取或设置用于对<see cref="OssObject" />按Key进行分组的字符。
  67. /// </summary>
  68. public string Delimiter
  69. {
  70. get { return _delimiter; }
  71. set
  72. {
  73. if (value != null && value.Length > OssUtils.MaxDelimiterStringSize)
  74. throw new ArgumentException("parameter 'delimiter' exceeds max size limit.");
  75. _delimiter = value;
  76. }
  77. }
  78. /// <summary>
  79. /// 获取encoding-type的值
  80. /// </summary>
  81. public string EncodingType
  82. {
  83. get
  84. {
  85. return this._encodingType != null ? this._encodingType : HttpUtils.UrlEncodingType;
  86. }
  87. set
  88. {
  89. this._encodingType = value;
  90. }
  91. }
  92. /// <summary>
  93. /// 使用给定的<see cref="Bucket" />名称构造一个新的<see cref="ListObjectsRequest" />实体。
  94. /// </summary>
  95. /// <param name="bucketName"><see cref="OssObject" />所在<see cref="Bucket" />的名称。</param>
  96. public ListObjectsRequest(string bucketName)
  97. {
  98. BucketName = bucketName;
  99. }
  100. }
  101. }