mirror.go 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. package s3
  2. import (
  3. "github.com/ks3sdklib/aws-sdk-go/aws"
  4. )
  5. type BucketMirror struct {
  6. Version *string `json:"version" type:"string" locationName:"version"`
  7. UseDefaultRobots *bool `json:"use_default_robots" locationName:"use_default_robots"`
  8. AsyncMirrorRule *AsyncMirrorRule `json:"async_mirror_rule,omitempty" type:"structure" locationName:"async_mirror_rule"`
  9. SyncMirrorRules []*SyncMirrorRules `json:"sync_mirror_rules,omitempty" type:"list" locationName:"sync_mirror_rules"`
  10. CreatedTime *string `json:"created_time,omitempty" type:"string" locationName:"created_time"`
  11. LastModifiedTime *string `json:"last_modified_time,omitempty" type:"string" locationName:"last_modified_time"`
  12. }
  13. type SavingSetting struct {
  14. ACL *string `json:"acl,omitempty" required:"true" locationName:"acl"`
  15. }
  16. type AsyncMirrorRule struct {
  17. MirrorUrls []*string `json:"mirror_urls,omitempty" required:"true" locationName:"mirror_urls"`
  18. SavingSetting *SavingSetting `json:"saving_setting,omitempty" required:"true" locationName:"saving_setting"`
  19. MirrorType *string `json:"mirror_type,omitempty" locationName:"mirror_type"`
  20. }
  21. type MatchCondition struct {
  22. HTTPCodes []*string `json:"http_codes" locationName:"http_codes"`
  23. KeyPrefixes []*string `json:"key_prefixes" locationName:"key_prefixes"`
  24. }
  25. type SetHeaders struct {
  26. Key *string `json:"key,omitempty" locationName:"key"`
  27. Value *string `json:"value,omitempty" locationName:"value"`
  28. }
  29. type RemoveHeaders struct {
  30. Key *string `json:"key,omitempty" locationName:"key"`
  31. }
  32. type PassHeaders struct {
  33. Key *string `json:"key,omitempty" locationName:"key"`
  34. }
  35. type HeaderSetting struct {
  36. SetHeaders []*SetHeaders `json:"set_headers,omitempty" locationName:"set_headers"`
  37. RemoveHeaders []*RemoveHeaders `json:"remove_headers,omitempty" locationName:"remove_headers"`
  38. PassAll *bool `json:"pass_all,omitempty" locationName:"pass_all"`
  39. PassHeaders []*PassHeaders `json:"pass_headers,omitempty" locationName:"pass_headers"`
  40. }
  41. type MirrorRequestSetting struct {
  42. PassQueryString *bool `json:"pass_query_string,omitempty" locationName:"pass_query_string"`
  43. Follow3Xx *bool `json:"follow3xx,omitempty" locationName:"follow3xx"`
  44. HeaderSetting *HeaderSetting `json:"header_setting,omitempty" locationName:"header_setting"`
  45. }
  46. type SyncMirrorRules struct {
  47. MatchCondition MatchCondition `json:"match_condition" locationName:"match_condition"`
  48. MirrorURL *string `json:"mirror_url,omitempty" locationName:"mirror_url"`
  49. MirrorRequestSetting *MirrorRequestSetting `json:"mirror_request_setting,omitempty" locationName:"mirror_request_setting"`
  50. SavingSetting *SavingSetting `json:"saving_setting,omitempty" locationName:"saving_setting"`
  51. MirrorType *string `json:"mirror_type,omitempty" locationName:"mirror_type"`
  52. }
  53. type PutBucketMirrorInput struct {
  54. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  55. BucketMirror *BucketMirror `locationName:"BucketMirror" json:"-" type:"structure"`
  56. ContentType *string `location:"header" locationName:"Content-Type" type:"string"`
  57. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  58. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  59. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  60. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  61. metadataPutBucketMirrorInput `json:"-" xml:"-"`
  62. }
  63. type metadataPutBucketMirrorInput struct {
  64. SDKShapeTraits bool `type:"structure" payload:"BucketMirror"`
  65. }
  66. type PutBucketMirrorOutput struct {
  67. Metadata map[string]*string `location:"headers" type:"map"`
  68. StatusCode *int64 `location:"statusCode" type:"integer"`
  69. }
  70. type GetBucketMirrorInput struct {
  71. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  72. ContentType *string `location:"header" locationName:"Content-Type" type:"string"`
  73. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  74. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  75. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  76. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  77. }
  78. type GetBucketMirrorOutput struct {
  79. BucketMirror *BucketMirror `locationName:"BucketMirror" type:"structure"`
  80. Metadata map[string]*string `location:"headers" type:"map"`
  81. StatusCode *int64 `location:"statusCode" type:"integer"`
  82. metadataGetBucketMirrorInput `json:"-" xml:"-"`
  83. }
  84. type metadataGetBucketMirrorInput struct {
  85. SDKShapeTraits bool `type:"structure" payload:"BucketMirror"`
  86. }
  87. type DeleteBucketMirrorInput struct {
  88. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  89. ContentType *string `location:"header" locationName:"Content-Type" type:"string"`
  90. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  91. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  92. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  93. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  94. }
  95. type DeleteBucketMirrorOutput struct {
  96. Metadata map[string]*string `location:"headers" type:"map"`
  97. StatusCode *int64 `location:"statusCode" type:"integer"`
  98. }
  99. func (c *S3) PutBucketMirrorRequest(input *PutBucketMirrorInput) (req *aws.Request, output *PutBucketMirrorOutput) {
  100. op := &aws.Operation{
  101. Name: "PutBucketMirror",
  102. HTTPMethod: "PUT",
  103. HTTPPath: "/{Bucket}?mirror",
  104. }
  105. if input == nil {
  106. input = &PutBucketMirrorInput{}
  107. }
  108. req = c.newRequest(op, input, output)
  109. req.ContentType = "application/json"
  110. output = &PutBucketMirrorOutput{}
  111. req.Data = output
  112. return
  113. }
  114. func (c *S3) PutBucketMirror(input *PutBucketMirrorInput) (*PutBucketMirrorOutput, error) {
  115. req, out := c.PutBucketMirrorRequest(input)
  116. err := req.Send()
  117. return out, err
  118. }
  119. func (c *S3) PutBucketMirrorWithContext(ctx aws.Context, input *PutBucketMirrorInput) (*PutBucketMirrorOutput, error) {
  120. req, out := c.PutBucketMirrorRequest(input)
  121. req.SetContext(ctx)
  122. err := req.Send()
  123. return out, err
  124. }
  125. func (c *S3) GetBucketMirrorRequest(input *GetBucketMirrorInput) (req *aws.Request, output *GetBucketMirrorOutput) {
  126. op := &aws.Operation{
  127. Name: "GetBucketMirror",
  128. HTTPMethod: "GET",
  129. HTTPPath: "/{Bucket}?mirror",
  130. }
  131. if input == nil {
  132. input = &GetBucketMirrorInput{}
  133. }
  134. req = c.newRequest(op, input, output)
  135. req.ContentType = "application/json"
  136. output = &GetBucketMirrorOutput{
  137. BucketMirror: &BucketMirror{},
  138. }
  139. req.Data = output
  140. return
  141. }
  142. func (c *S3) GetBucketMirror(input *GetBucketMirrorInput) (*GetBucketMirrorOutput, error) {
  143. req, out := c.GetBucketMirrorRequest(input)
  144. err := req.Send()
  145. return out, err
  146. }
  147. func (c *S3) GetBucketMirrorWithContext(ctx aws.Context, input *GetBucketMirrorInput) (*GetBucketMirrorOutput, error) {
  148. req, out := c.GetBucketMirrorRequest(input)
  149. req.SetContext(ctx)
  150. err := req.Send()
  151. return out, err
  152. }
  153. func (c *S3) DeleteBucketMirrorRequest(input *DeleteBucketMirrorInput) (req *aws.Request, output *DeleteBucketMirrorOutput) {
  154. op := &aws.Operation{
  155. Name: "DeleteBucketMirror",
  156. HTTPMethod: "DELETE",
  157. HTTPPath: "/{Bucket}?mirror",
  158. }
  159. if input == nil {
  160. input = &DeleteBucketMirrorInput{}
  161. }
  162. req = c.newRequest(op, input, output)
  163. output = &DeleteBucketMirrorOutput{}
  164. req.Data = output
  165. return
  166. }
  167. func (c *S3) DeleteBucketMirror(input *DeleteBucketMirrorInput) (*DeleteBucketMirrorOutput, error) {
  168. req, out := c.DeleteBucketMirrorRequest(input)
  169. err := req.Send()
  170. return out, err
  171. }
  172. func (c *S3) DeleteBucketMirrorWithContext(ctx aws.Context, input *DeleteBucketMirrorInput) (*DeleteBucketMirrorOutput, error) {
  173. req, out := c.DeleteBucketMirrorRequest(input)
  174. req.SetContext(ctx)
  175. err := req.Send()
  176. return out, err
  177. }