ReplicationConfiguration.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Xml.Serialization;
  4. using System.Text;
  5. namespace COSXML.Model.Tag
  6. {
  7. [XmlRoot("ReplicationConfiguration")]
  8. public sealed class ReplicationConfiguration
  9. {
  10. [XmlElement("Role")]
  11. public string role;
  12. [XmlElement("Rule")]
  13. public List<Rule> rules;
  14. public string GetInfo()
  15. {
  16. StringBuilder stringBuilder = new StringBuilder("{ReplicationConfiguration:\n");
  17. stringBuilder.Append("Role:").Append(role).Append("\n");
  18. if (rules != null)
  19. {
  20. foreach (Rule rule in rules)
  21. {
  22. if (rule != null)
  23. {
  24. stringBuilder.Append(rule.GetInfo()).Append("\n");
  25. }
  26. }
  27. }
  28. stringBuilder.Append("}");
  29. return stringBuilder.ToString();
  30. }
  31. public sealed class Rule
  32. {
  33. [XmlElement("ID")]
  34. public string id;
  35. [XmlElement("Status")]
  36. public string status;
  37. [XmlElement("Prefix")]
  38. public string prefix;
  39. [XmlElement("Destination")]
  40. public Destination destination;
  41. public string GetInfo()
  42. {
  43. StringBuilder stringBuilder = new StringBuilder("{Rule:\n");
  44. stringBuilder.Append("Id:").Append(id).Append("\n");
  45. stringBuilder.Append("Status:").Append(status).Append("\n");
  46. stringBuilder.Append("Prefix:").Append(prefix).Append("\n");
  47. if (destination != null)
  48. {
  49. stringBuilder.Append(destination.GetInfo()).Append("\n");
  50. }
  51. stringBuilder.Append("}");
  52. return stringBuilder.ToString();
  53. }
  54. }
  55. public sealed class Destination
  56. {
  57. [XmlElement("Bucket")]
  58. public string bucket;
  59. [XmlElement("StorageClass")]
  60. public string storageClass;
  61. public string GetInfo()
  62. {
  63. StringBuilder stringBuilder = new StringBuilder("{Destination:\n");
  64. stringBuilder.Append("Bucket:").Append(bucket).Append("\n");
  65. stringBuilder.Append("StorageClass:").Append(storageClass).Append("\n");
  66. stringBuilder.Append("}");
  67. return stringBuilder.ToString();
  68. }
  69. }
  70. }
  71. }