object.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package baidu
  15. import (
  16. "context"
  17. "net/http"
  18. "time"
  19. "yunion.io/x/cloudmux/pkg/cloudprovider"
  20. )
  21. type SObject struct {
  22. cloudprovider.SBaseCloudObject
  23. bucket *SBucket
  24. Key string
  25. LastModified time.Time
  26. ETag string
  27. Size int64
  28. StorageClass string
  29. Owner struct {
  30. Id string
  31. DisplayName string
  32. }
  33. }
  34. func (o *SObject) GetKey() string {
  35. return o.Key
  36. }
  37. func (o *SObject) GetSizeBytes() int64 {
  38. return o.Size
  39. }
  40. func (o *SObject) GetLastModified() time.Time {
  41. return o.LastModified
  42. }
  43. func (o *SObject) GetStorageClass() string {
  44. return o.StorageClass
  45. }
  46. func (o *SObject) GetETag() string {
  47. return o.ETag
  48. }
  49. func (o *SObject) GetOwner() struct {
  50. Id string
  51. DisplayName string
  52. } {
  53. return o.Owner
  54. }
  55. func (o *SObject) GetAcl() cloudprovider.TBucketACLType {
  56. return cloudprovider.ACLPrivate
  57. }
  58. func (o *SObject) SetAcl(acl cloudprovider.TBucketACLType) error {
  59. return o.bucket.SetAcl(acl)
  60. }
  61. func (o *SObject) GetMeta() http.Header {
  62. return o.Meta
  63. }
  64. func (o *SObject) SetMeta(ctx context.Context, meta http.Header) error {
  65. return cloudprovider.ErrNotImplemented
  66. }
  67. func (o *SObject) GetIBucket() cloudprovider.ICloudBucket {
  68. return o.bucket
  69. }