DeleteResult.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Xml.Serialization;
  4. using System.Text;
  5. namespace COSXML.Model.Tag
  6. {
  7. /// <summary>
  8. /// 本次删除返回结果的方式和目标 Object
  9. /// <see href="https://cloud.tencent.com/document/product/436/8289"/>
  10. /// </summary>
  11. [XmlRoot("DeleteResult")]
  12. public sealed class DeleteResult
  13. {
  14. /// <summary>
  15. /// 本次删除的成功 Object 信息
  16. /// <see href="Deleted"/>
  17. /// </summary>
  18. [XmlElement("Deleted")]
  19. public List<Deleted> deletedList;
  20. /// <summary>
  21. /// 本次删除的失败 Object 信息
  22. /// <see href="Error"/>
  23. /// </summary>
  24. [XmlElement("Error")]
  25. public List<Error> errorList;
  26. public string GetInfo()
  27. {
  28. StringBuilder stringBuilder = new StringBuilder("{DeleteResult:\n");
  29. if (deletedList != null)
  30. {
  31. foreach (Deleted deleted in deletedList)
  32. {
  33. if (deleted != null)
  34. {
  35. stringBuilder.Append(deleted.GetInfo()).Append("\n");
  36. }
  37. }
  38. }
  39. if (errorList != null)
  40. {
  41. foreach (Error error in errorList)
  42. {
  43. if (error != null)
  44. {
  45. stringBuilder.Append(error.GetInfo()).Append("\n");
  46. }
  47. }
  48. }
  49. stringBuilder.Append("}");
  50. return stringBuilder.ToString();
  51. }
  52. public sealed class Deleted
  53. {
  54. /// <summary>
  55. /// Object 的名称
  56. /// </summary>
  57. [XmlElement("Key")]
  58. public string key;
  59. /// <summary>
  60. /// Object 的版本Id
  61. /// </summary>
  62. [XmlElement("VersionId")]
  63. public string versionId;
  64. /// <summary>
  65. /// deleete marker
  66. /// </summary>
  67. [XmlElement("DeleteMarker")]
  68. public string deleteMarker;
  69. /// <summary>
  70. /// delete marker versionId
  71. /// </summary>
  72. [XmlElement("DeleteMarkerVersionId")]
  73. public string deleteMarkerVersionId;
  74. public string GetInfo()
  75. {
  76. StringBuilder stringBuilder = new StringBuilder("{Deleted:\n");
  77. stringBuilder.Append("Key:").Append(key).Append("\n");
  78. stringBuilder.Append("VersionId:").Append(versionId).Append("\n");
  79. stringBuilder.Append("DeleteMarker:").Append(deleteMarker).Append("\n");
  80. stringBuilder.Append("DeleteMarkerVersionId:").Append(deleteMarkerVersionId).Append("\n");
  81. stringBuilder.Append("}");
  82. return stringBuilder.ToString();
  83. }
  84. }
  85. public sealed class Error
  86. {
  87. /// <summary>
  88. /// 删除失败的 Object 的名称
  89. /// </summary>
  90. [XmlElement("Key")]
  91. public string key;
  92. /// <summary>
  93. /// 删除失败的错误代码
  94. /// </summary>
  95. [XmlElement("Code")]
  96. public string code;
  97. /// <summary>
  98. /// 删除失败的错误信息
  99. /// </summary>
  100. [XmlElement("Message")]
  101. public string message;
  102. /// <summary>
  103. /// 删除失败的 Object 的 版本Id
  104. /// </summary>
  105. [XmlElement("VersionId")]
  106. public string versionId;
  107. public string GetInfo()
  108. {
  109. StringBuilder stringBuilder = new StringBuilder("{Error:\n");
  110. stringBuilder.Append("Key:").Append(key).Append("\n");
  111. stringBuilder.Append("Code:").Append(code).Append("\n");
  112. stringBuilder.Append("Message:").Append(message).Append("\n");
  113. stringBuilder.Append("VersionId:").Append(versionId).Append("\n");
  114. stringBuilder.Append("}");
  115. return stringBuilder.ToString();
  116. }
  117. }
  118. }
  119. }