InventoryConfiguration.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Xml.Serialization;
  5. namespace COSXML.Model.Tag
  6. {
  7. [XmlRoot]
  8. public sealed class InventoryConfiguration
  9. {
  10. [XmlElement("Id")]
  11. public string id;
  12. [XmlElement("IsEnabled")]
  13. public bool isEnabled;
  14. [XmlElement("IncludedObjectVersions")]
  15. public string includedObjectVersions;
  16. [XmlElement("Filter")]
  17. public Filter filter;
  18. [XmlElement("OptionalFields")]
  19. public OptionalFields optionalFields;
  20. [XmlElement("Schedule")]
  21. public Schedule schedule;
  22. [XmlElement("Destination")]
  23. public Destination destination;
  24. public string GetInfo()
  25. {
  26. StringBuilder stringBuilder = new StringBuilder("{InventoryConfiguration:\n");
  27. stringBuilder.Append("Id").Append(id).Append("\n");
  28. stringBuilder.Append("IsEnabled:").Append(isEnabled).Append("\n");
  29. if (destination != null)
  30. {
  31. stringBuilder.Append(destination.GetInfo()).Append("\n");
  32. }
  33. if (schedule != null)
  34. {
  35. stringBuilder.Append(schedule.GetInfo()).Append("\n");
  36. }
  37. if (filter != null)
  38. {
  39. stringBuilder.Append(filter.GetInfo()).Append("\n");
  40. }
  41. stringBuilder.Append("IncludedObjectVersions:").Append(includedObjectVersions).Append("\n");
  42. if (optionalFields != null)
  43. {
  44. stringBuilder.Append(optionalFields.GetInfo()).Append("\n");
  45. }
  46. stringBuilder.Append("}");
  47. return stringBuilder.ToString();
  48. }
  49. public sealed class Filter
  50. {
  51. [XmlElement("Prefix")]
  52. public string prefix;
  53. public string GetInfo()
  54. {
  55. StringBuilder stringBuilder = new StringBuilder("{Filter:\n");
  56. stringBuilder.Append("Prefix:").Append(prefix).Append("\n");
  57. stringBuilder.Append("}");
  58. return stringBuilder.ToString();
  59. }
  60. }
  61. public sealed class OptionalFields
  62. {
  63. [XmlElement("Field")]
  64. public List<string> fields;
  65. public string GetInfo()
  66. {
  67. StringBuilder stringBuilder = new StringBuilder("{OptionalFields:\n");
  68. if (fields != null)
  69. {
  70. foreach (string field in fields)
  71. {
  72. stringBuilder.Append("Field:").Append(field).Append("\n");
  73. }
  74. }
  75. stringBuilder.Append("}");
  76. return stringBuilder.ToString();
  77. }
  78. }
  79. public sealed class Schedule
  80. {
  81. [XmlElement("Frequency")]
  82. public string frequency;
  83. public string GetInfo()
  84. {
  85. StringBuilder stringBuilder = new StringBuilder("{Schedule:\n");
  86. stringBuilder.Append("Frequency:").Append(frequency).Append("\n");
  87. stringBuilder.Append("}");
  88. return stringBuilder.ToString();
  89. }
  90. }
  91. public sealed class Destination
  92. {
  93. [XmlElement("COSBucketDestination")]
  94. public COSBucketDestination cosBucketDestination;
  95. public string GetInfo()
  96. {
  97. StringBuilder stringBuilder = new StringBuilder("{Destination:\n");
  98. if (cosBucketDestination != null)
  99. {
  100. stringBuilder.Append(cosBucketDestination.GetInfo()).Append("\n");
  101. }
  102. stringBuilder.Append("}");
  103. return stringBuilder.ToString();
  104. }
  105. }
  106. public sealed class COSBucketDestination
  107. {
  108. [XmlElement("Format")]
  109. public string format;
  110. [XmlElement("AccountId")]
  111. public string accountId;
  112. [XmlElement("Bucket")]
  113. public string bucket;
  114. [XmlElement("Prefix")]
  115. public string prefix;
  116. [XmlElement("Encryption")]
  117. public Encryption encryption;
  118. public string GetInfo()
  119. {
  120. StringBuilder stringBuilder = new StringBuilder("{COSBucketDestination:\n");
  121. stringBuilder.Append("Format:").Append(format).Append("\n");
  122. stringBuilder.Append("AccountId:").Append(accountId).Append("\n");
  123. stringBuilder.Append("Bucket:").Append(bucket).Append("\n");
  124. stringBuilder.Append("Prefix:").Append(prefix).Append("\n");
  125. if (encryption != null)
  126. {
  127. stringBuilder.Append(encryption.GetInfo()).Append("\n");
  128. }
  129. stringBuilder.Append("}");
  130. return stringBuilder.ToString();
  131. }
  132. }
  133. public sealed class Encryption
  134. {
  135. [XmlElement("SSE-COS")]
  136. public string sSECOS;
  137. public String GetInfo()
  138. {
  139. StringBuilder stringBuilder = new StringBuilder("{Encryption:\n");
  140. stringBuilder.Append("SSE-COS:").Append(sSECOS).Append("\n");
  141. stringBuilder.Append("}");
  142. return stringBuilder.ToString();
  143. }
  144. }
  145. }
  146. }