github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/obs/model_base.go (about) 1 package obs 2 3 import ( 4 "encoding/xml" 5 "time" 6 ) 7 8 // Bucket defines bucket properties 9 type Bucket struct { 10 XMLName xml.Name `xml:"Bucket"` 11 Name string `xml:"Name"` 12 CreationDate time.Time `xml:"CreationDate"` 13 Location string `xml:"Location"` 14 BucketType string `xml:"BucketType,omitempty"` 15 } 16 17 // Owner defines owner properties 18 type Owner struct { 19 XMLName xml.Name `xml:"Owner"` 20 ID string `xml:"ID"` 21 DisplayName string `xml:"DisplayName,omitempty"` 22 } 23 24 // Initiator defines initiator properties 25 type Initiator struct { 26 XMLName xml.Name `xml:"Initiator"` 27 ID string `xml:"ID"` 28 DisplayName string `xml:"DisplayName,omitempty"` 29 } 30 31 type bucketLocationObs struct { 32 XMLName xml.Name `xml:"Location"` 33 Location string `xml:",chardata"` 34 } 35 36 // BucketLocation defines bucket location configuration 37 type BucketLocation struct { 38 XMLName xml.Name `xml:"CreateBucketConfiguration"` 39 Location string `xml:"LocationConstraint,omitempty"` 40 } 41 42 // BucketStoragePolicy defines the bucket storage class 43 type BucketStoragePolicy struct { 44 XMLName xml.Name `xml:"StoragePolicy"` 45 StorageClass StorageClassType `xml:"DefaultStorageClass"` 46 } 47 48 type bucketStoragePolicyObs struct { 49 XMLName xml.Name `xml:"StorageClass"` 50 StorageClass string `xml:",chardata"` 51 } 52 53 // Content defines the object content properties 54 type Content struct { 55 XMLName xml.Name `xml:"Contents"` 56 Owner Owner `xml:"Owner"` 57 ETag string `xml:"ETag"` 58 Key string `xml:"Key"` 59 LastModified time.Time `xml:"LastModified"` 60 Size int64 `xml:"Size"` 61 StorageClass StorageClassType `xml:"StorageClass"` 62 } 63 64 // Version defines the properties of versioning objects 65 type Version struct { 66 DeleteMarker 67 XMLName xml.Name `xml:"Version"` 68 ETag string `xml:"ETag"` 69 Size int64 `xml:"Size"` 70 } 71 72 // DeleteMarker defines the properties of versioning delete markers 73 type DeleteMarker struct { 74 XMLName xml.Name `xml:"DeleteMarker"` 75 Key string `xml:"Key"` 76 VersionId string `xml:"VersionId"` 77 IsLatest bool `xml:"IsLatest"` 78 LastModified time.Time `xml:"LastModified"` 79 Owner Owner `xml:"Owner"` 80 StorageClass StorageClassType `xml:"StorageClass"` 81 } 82 83 // Upload defines multipart upload properties 84 type Upload struct { 85 XMLName xml.Name `xml:"Upload"` 86 Key string `xml:"Key"` 87 UploadId string `xml:"UploadId"` 88 Initiated time.Time `xml:"Initiated"` 89 StorageClass StorageClassType `xml:"StorageClass"` 90 Owner Owner `xml:"Owner"` 91 Initiator Initiator `xml:"Initiator"` 92 } 93 94 // BucketQuota defines bucket quota configuration 95 type BucketQuota struct { 96 XMLName xml.Name `xml:"Quota"` 97 Quota int64 `xml:"StorageQuota"` 98 } 99 100 // Grantee defines grantee properties 101 type Grantee struct { 102 XMLName xml.Name `xml:"Grantee"` 103 Type GranteeType `xml:"type,attr"` 104 ID string `xml:"ID,omitempty"` 105 DisplayName string `xml:"DisplayName,omitempty"` 106 URI GroupUriType `xml:"URI,omitempty"` 107 } 108 109 // Grant defines grant properties 110 type Grant struct { 111 XMLName xml.Name `xml:"Grant"` 112 Grantee Grantee `xml:"Grantee"` 113 Permission PermissionType `xml:"Permission"` 114 Delivered bool `xml:"Delivered"` 115 } 116 117 // AccessControlPolicy defines access control policy properties 118 type AccessControlPolicy struct { 119 XMLName xml.Name `xml:"AccessControlPolicy"` 120 Owner Owner `xml:"Owner"` 121 Grants []Grant `xml:"AccessControlList>Grant"` 122 Delivered string `xml:"Delivered,omitempty"` 123 } 124 125 // CorsRule defines the CORS rules 126 type CorsRule struct { 127 XMLName xml.Name `xml:"CORSRule"` 128 ID string `xml:"ID,omitempty"` 129 AllowedOrigin []string `xml:"AllowedOrigin"` 130 AllowedMethod []string `xml:"AllowedMethod"` 131 AllowedHeader []string `xml:"AllowedHeader,omitempty"` 132 MaxAgeSeconds int `xml:"MaxAgeSeconds"` 133 ExposeHeader []string `xml:"ExposeHeader,omitempty"` 134 } 135 136 // BucketCors defines the bucket CORS configuration 137 type BucketCors struct { 138 XMLName xml.Name `xml:"CORSConfiguration"` 139 CorsRules []CorsRule `xml:"CORSRule"` 140 } 141 142 // BucketVersioningConfiguration defines the versioning configuration 143 type BucketVersioningConfiguration struct { 144 XMLName xml.Name `xml:"VersioningConfiguration"` 145 Status VersioningStatusType `xml:"Status"` 146 } 147 148 // IndexDocument defines the default page configuration 149 type IndexDocument struct { 150 Suffix string `xml:"Suffix"` 151 } 152 153 // ErrorDocument defines the error page configuration 154 type ErrorDocument struct { 155 Key string `xml:"Key,omitempty"` 156 } 157 158 // Condition defines condition in RoutingRule 159 type Condition struct { 160 XMLName xml.Name `xml:"Condition"` 161 KeyPrefixEquals string `xml:"KeyPrefixEquals,omitempty"` 162 HttpErrorCodeReturnedEquals string `xml:"HttpErrorCodeReturnedEquals,omitempty"` 163 } 164 165 // Redirect defines redirect in RoutingRule 166 type Redirect struct { 167 XMLName xml.Name `xml:"Redirect"` 168 Protocol ProtocolType `xml:"Protocol,omitempty"` 169 HostName string `xml:"HostName,omitempty"` 170 ReplaceKeyPrefixWith string `xml:"ReplaceKeyPrefixWith,omitempty"` 171 ReplaceKeyWith string `xml:"ReplaceKeyWith,omitempty"` 172 HttpRedirectCode string `xml:"HttpRedirectCode,omitempty"` 173 } 174 175 // RoutingRule defines routing rules 176 type RoutingRule struct { 177 XMLName xml.Name `xml:"RoutingRule"` 178 Condition Condition `xml:"Condition,omitempty"` 179 Redirect Redirect `xml:"Redirect"` 180 } 181 182 // RedirectAllRequestsTo defines redirect in BucketWebsiteConfiguration 183 type RedirectAllRequestsTo struct { 184 XMLName xml.Name `xml:"RedirectAllRequestsTo"` 185 Protocol ProtocolType `xml:"Protocol,omitempty"` 186 HostName string `xml:"HostName"` 187 } 188 189 // BucketWebsiteConfiguration defines the bucket website configuration 190 type BucketWebsiteConfiguration struct { 191 XMLName xml.Name `xml:"WebsiteConfiguration"` 192 RedirectAllRequestsTo RedirectAllRequestsTo `xml:"RedirectAllRequestsTo,omitempty"` 193 IndexDocument IndexDocument `xml:"IndexDocument,omitempty"` 194 ErrorDocument ErrorDocument `xml:"ErrorDocument,omitempty"` 195 RoutingRules []RoutingRule `xml:"RoutingRules>RoutingRule,omitempty"` 196 } 197 198 // BucketLoggingStatus defines the bucket logging configuration 199 type BucketLoggingStatus struct { 200 XMLName xml.Name `xml:"BucketLoggingStatus"` 201 Agency string `xml:"Agency,omitempty"` 202 TargetBucket string `xml:"LoggingEnabled>TargetBucket,omitempty"` 203 TargetPrefix string `xml:"LoggingEnabled>TargetPrefix,omitempty"` 204 TargetGrants []Grant `xml:"LoggingEnabled>TargetGrants>Grant,omitempty"` 205 } 206 207 // Transition defines transition property in LifecycleRule 208 type Transition struct { 209 XMLName xml.Name `xml:"Transition"` 210 Date time.Time `xml:"Date,omitempty"` 211 Days int `xml:"Days,omitempty"` 212 StorageClass StorageClassType `xml:"StorageClass"` 213 } 214 215 // Expiration defines expiration property in LifecycleRule 216 type Expiration struct { 217 XMLName xml.Name `xml:"Expiration"` 218 Date time.Time `xml:"Date,omitempty"` 219 Days int `xml:"Days,omitempty"` 220 } 221 222 // NoncurrentVersionTransition defines noncurrentVersion transition property in LifecycleRule 223 type NoncurrentVersionTransition struct { 224 XMLName xml.Name `xml:"NoncurrentVersionTransition"` 225 NoncurrentDays int `xml:"NoncurrentDays"` 226 StorageClass StorageClassType `xml:"StorageClass"` 227 } 228 229 // NoncurrentVersionExpiration defines noncurrentVersion expiration property in LifecycleRule 230 type NoncurrentVersionExpiration struct { 231 XMLName xml.Name `xml:"NoncurrentVersionExpiration"` 232 NoncurrentDays int `xml:"NoncurrentDays"` 233 } 234 235 // LifecycleRule defines lifecycle rule 236 type LifecycleRule struct { 237 ID string `xml:"ID,omitempty"` 238 Prefix string `xml:"Prefix"` 239 Status RuleStatusType `xml:"Status"` 240 Transitions []Transition `xml:"Transition,omitempty"` 241 Expiration Expiration `xml:"Expiration,omitempty"` 242 NoncurrentVersionTransitions []NoncurrentVersionTransition `xml:"NoncurrentVersionTransition,omitempty"` 243 NoncurrentVersionExpiration NoncurrentVersionExpiration `xml:"NoncurrentVersionExpiration,omitempty"` 244 } 245 246 // BucketEncryptionConfiguration defines the bucket encryption configuration 247 type BucketEncryptionConfiguration struct { 248 XMLName xml.Name `xml:"ServerSideEncryptionConfiguration"` 249 SSEAlgorithm string `xml:"Rule>ApplyServerSideEncryptionByDefault>SSEAlgorithm"` 250 KMSMasterKeyID string `xml:"Rule>ApplyServerSideEncryptionByDefault>KMSMasterKeyID,omitempty"` 251 ProjectID string `xml:"Rule>ApplyServerSideEncryptionByDefault>ProjectID,omitempty"` 252 } 253 254 // Tag defines tag property in BucketTagging 255 type Tag struct { 256 XMLName xml.Name `xml:"Tag"` 257 Key string `xml:"Key"` 258 Value string `xml:"Value"` 259 } 260 261 // BucketTagging defines the bucket tag configuration 262 type BucketTagging struct { 263 XMLName xml.Name `xml:"Tagging"` 264 Tags []Tag `xml:"TagSet>Tag"` 265 } 266 267 // FilterRule defines filter rule in TopicConfiguration 268 type FilterRule struct { 269 XMLName xml.Name `xml:"FilterRule"` 270 Name string `xml:"Name,omitempty"` 271 Value string `xml:"Value,omitempty"` 272 } 273 274 // TopicConfiguration defines the topic configuration 275 type TopicConfiguration struct { 276 XMLName xml.Name `xml:"TopicConfiguration"` 277 ID string `xml:"Id,omitempty"` 278 Topic string `xml:"Topic"` 279 Events []EventType `xml:"Event"` 280 FilterRules []FilterRule `xml:"Filter>Object>FilterRule"` 281 } 282 283 // BucketNotification defines the bucket notification configuration 284 type BucketNotification struct { 285 XMLName xml.Name `xml:"NotificationConfiguration"` 286 TopicConfigurations []TopicConfiguration `xml:"TopicConfiguration"` 287 } 288 289 type topicConfigurationS3 struct { 290 XMLName xml.Name `xml:"TopicConfiguration"` 291 ID string `xml:"Id,omitempty"` 292 Topic string `xml:"Topic"` 293 Events []string `xml:"Event"` 294 FilterRules []FilterRule `xml:"Filter>S3Key>FilterRule"` 295 } 296 297 type bucketNotificationS3 struct { 298 XMLName xml.Name `xml:"NotificationConfiguration"` 299 TopicConfigurations []topicConfigurationS3 `xml:"TopicConfiguration"` 300 } 301 302 // ObjectToDelete defines the object property in DeleteObjectsInput 303 type ObjectToDelete struct { 304 XMLName xml.Name `xml:"Object"` 305 Key string `xml:"Key"` 306 VersionId string `xml:"VersionId,omitempty"` 307 } 308 309 // Deleted defines the deleted property in DeleteObjectsOutput 310 type Deleted struct { 311 XMLName xml.Name `xml:"Deleted"` 312 Key string `xml:"Key"` 313 VersionId string `xml:"VersionId"` 314 DeleteMarker bool `xml:"DeleteMarker"` 315 DeleteMarkerVersionId string `xml:"DeleteMarkerVersionId"` 316 } 317 318 // Part defines the part properties 319 type Part struct { 320 XMLName xml.Name `xml:"Part"` 321 PartNumber int `xml:"PartNumber"` 322 ETag string `xml:"ETag"` 323 LastModified time.Time `xml:"LastModified,omitempty"` 324 Size int64 `xml:"Size,omitempty"` 325 } 326 327 // BucketReplicationConfiguration defines the bucket cross-region replication configuration 328 type BucketReplicationConfiguration struct { 329 XMLName xml.Name `xml:"ReplicationConfiguration"` 330 Agency string `xml:"Agency"` 331 ReplicationRules []ReplicationRule `xml:"Rule"` 332 } 333 334 // ReplicationRule defines bucket cross-region replication rule 335 type ReplicationRule struct { 336 ID string `xml:"ID,omitempty"` 337 Prefix string `xml:"Prefix"` 338 Status RuleStatusType `xml:"Status"` 339 DestinationBucket string `xml:"Destination>Bucket"` 340 StorageClass StorageClassType `xml:"Destination>StorageClass,omitempty"` 341 DeleteData EnabledType `xml:"Destination>DeleteData,omitempty"` 342 HistoricalObjectReplication EnabledType `xml:"HistoricalObjectReplication,omitempty"` 343 } 344 345 // BucketWormPolicy defines bucket WORM policy rule 346 type BucketWormPolicy struct { 347 XMLName xml.Name `xml:"ObjectLockConfiguration"` 348 ObjectLockEnabled string `xml:"ObjectLockEnabled,omitempty"` 349 Mode string `xml:"Rule>DefaultRetention>Mode,omitempty"` 350 Days string `xml:"Rule>DefaultRetention>Days,omitempty"` 351 Years string `xml:"Rule>DefaultRetention>Years,omitempty"` 352 }