using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; namespace COSXML.Model.Tag { /// /// 本次删除返回结果的方式和目标 Object /// /// [XmlRoot("DeleteResult")] public sealed class DeleteResult { /// /// 本次删除的成功 Object 信息 /// /// [XmlElement("Deleted")] public List deletedList; /// /// 本次删除的失败 Object 信息 /// /// [XmlElement("Error")] public List errorList; public string GetInfo() { StringBuilder stringBuilder = new StringBuilder("{DeleteResult:\n"); if (deletedList != null) { foreach (Deleted deleted in deletedList) { if (deleted != null) { stringBuilder.Append(deleted.GetInfo()).Append("\n"); } } } if (errorList != null) { foreach (Error error in errorList) { if (error != null) { stringBuilder.Append(error.GetInfo()).Append("\n"); } } } stringBuilder.Append("}"); return stringBuilder.ToString(); } public sealed class Deleted { /// /// Object 的名称 /// [XmlElement("Key")] public string key; /// /// Object 的版本Id /// [XmlElement("VersionId")] public string versionId; /// /// deleete marker /// [XmlElement("DeleteMarker")] public string deleteMarker; /// /// delete marker versionId /// [XmlElement("DeleteMarkerVersionId")] public string deleteMarkerVersionId; public string GetInfo() { StringBuilder stringBuilder = new StringBuilder("{Deleted:\n"); stringBuilder.Append("Key:").Append(key).Append("\n"); stringBuilder.Append("VersionId:").Append(versionId).Append("\n"); stringBuilder.Append("DeleteMarker:").Append(deleteMarker).Append("\n"); stringBuilder.Append("DeleteMarkerVersionId:").Append(deleteMarkerVersionId).Append("\n"); stringBuilder.Append("}"); return stringBuilder.ToString(); } } public sealed class Error { /// /// 删除失败的 Object 的名称 /// [XmlElement("Key")] public string key; /// /// 删除失败的错误代码 /// [XmlElement("Code")] public string code; /// /// 删除失败的错误信息 /// [XmlElement("Message")] public string message; /// /// 删除失败的 Object 的 版本Id /// [XmlElement("VersionId")] public string versionId; public string GetInfo() { StringBuilder stringBuilder = new StringBuilder("{Error:\n"); stringBuilder.Append("Key:").Append(key).Append("\n"); stringBuilder.Append("Code:").Append(code).Append("\n"); stringBuilder.Append("Message:").Append(message).Append("\n"); stringBuilder.Append("VersionId:").Append(versionId).Append("\n"); stringBuilder.Append("}"); return stringBuilder.ToString(); } } } }