decompresspolicy.go 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. package s3
  2. import "github.com/ks3sdklib/aws-sdk-go/aws"
  3. // PutBucketDecompressPolicyRequest generates a request for the PutBucketDecompressPolicy operation.
  4. func (c *S3) PutBucketDecompressPolicyRequest(input *PutBucketDecompressPolicyInput) (req *aws.Request, output *PutBucketDecompressPolicyOutput) {
  5. op := &aws.Operation{
  6. Name: "PutBucketDecompressPolicy",
  7. HTTPMethod: "PUT",
  8. HTTPPath: "/{Bucket}?decompresspolicy",
  9. }
  10. if input == nil {
  11. input = &PutBucketDecompressPolicyInput{}
  12. }
  13. req = c.newRequest(op, input, output)
  14. req.ContentType = "application/json"
  15. output = &PutBucketDecompressPolicyOutput{}
  16. req.Data = output
  17. return
  18. }
  19. // PutBucketDecompressPolicy sets the decompression policy for the bucket.
  20. func (c *S3) PutBucketDecompressPolicy(input *PutBucketDecompressPolicyInput) (*PutBucketDecompressPolicyOutput, error) {
  21. req, out := c.PutBucketDecompressPolicyRequest(input)
  22. err := req.Send()
  23. return out, err
  24. }
  25. func (c *S3) PutBucketDecompressPolicyWithContext(ctx aws.Context, input *PutBucketDecompressPolicyInput) (*PutBucketDecompressPolicyOutput, error) {
  26. req, out := c.PutBucketDecompressPolicyRequest(input)
  27. req.SetContext(ctx)
  28. err := req.Send()
  29. return out, err
  30. }
  31. type PutBucketDecompressPolicyInput struct {
  32. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  33. BucketDecompressPolicy *BucketDecompressPolicy `locationName:"BucketDecompressPolicy" type:"structure"`
  34. ContentType *string `location:"header" locationName:"Content-Type" type:"string"`
  35. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  36. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  37. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  38. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  39. metadataPutBucketDecompressPolicyInput `json:"-" xml:"-"`
  40. }
  41. type metadataPutBucketDecompressPolicyInput struct {
  42. SDKShapeTraits bool `type:"structure" payload:"BucketDecompressPolicy"`
  43. }
  44. type BucketDecompressPolicy struct {
  45. Rules []*DecompressPolicyRule `json:"rules,omitempty" type:"list" locationName:"rules" required:"true"`
  46. }
  47. type DecompressPolicyRule struct {
  48. // The name of the decompression strategy and the unique identifier of the decompression rule configured by the bucket. Value range: [1, 256].
  49. // Description: The length is 1-256 characters and can only be composed of uppercase or lowercase English letters, numbers, underscores (_), and hyphens (-).
  50. Id *string `json:"id,omitempty" type:"string" locationName:"id" required:"true"`
  51. // ZIP online decompression trigger event, currently supports the following operations:
  52. // "ObjectCreated:*": represents all operations for creating objects, including Put, Post, Copy objects, and merging segmentation tasks;
  53. // "ObjectCreated:Put": Use the Put method to upload a ZIP package;
  54. // "ObjectCreated:Post": Use the Post method to upload a ZIP package;
  55. // "ObjectCreated:Copy": Use the Copy method to copy a ZIP package;
  56. // "ObjectCreated:CompleteMultipartUpload": Use merge to upload ZIP packages in chunks.
  57. Events *string `json:"events,omitempty" type:"string" locationName:"events" required:"true"`
  58. // Match rule prefix (ZIP package that matches the prefix).
  59. // If no prefix is specified, all ZIP packages uploaded will be matched by default.
  60. Prefix *string `json:"prefix,omitempty" type:"string" locationName:"prefix"`
  61. // Match rule suffix.
  62. // The default is. zip, and currently only supports ZIP package format.
  63. Suffix []*string `json:"suffix,omitempty" type:"list" locationName:"suffix" required:"true"`
  64. // The processing method for files with the same name after decompression is not to overwrite them by default
  65. // The parameter values are as follows:
  66. // 0 (default value): Do not overwrite skip, keep existing objects in the bucket, skip objects with the same name, do not decompress;
  67. // 1: Overwrite, preserve the extracted object, and delete any existing objects with the same name in the bucket.
  68. Overwrite *int64 `json:"overwrite,omitempty" type:"integer" locationName:"overwrite" required:"true"`
  69. // The address for task callback, URL address.
  70. Callback *string `json:"callback,omitempty" type:"string" locationName:"callback"`
  71. // Task callback format, JSON format (required if callback address is set).
  72. CallbackFormat *string `json:"callback_format,omitempty" type:"string" locationName:"callback_format"`
  73. // Specify the prefix of the output file in the target bucket after decompression. If it is not empty, it must end with a '/'.
  74. // If left blank, it will be saved by default in the root path of the storage bucket.
  75. PathPrefix *string `json:"path_prefix,omitempty" type:"string" locationName:"path_prefix"`
  76. // Specify whether the compressed file path requires a compressed file name, with the following parameter values:
  77. // 0 (default): Keep compressed file name
  78. // 1: Extract directly to the target directory
  79. PathPrefixReplaced *int64 `json:"path_prefix_replaced,omitempty" type:"integer" locationName:"path_prefix_replaced"`
  80. // Type of file decompression strategy.
  81. // Fixed value: decompress.
  82. PolicyType *string `json:"policy_type,omitempty" type:"string" locationName:"policy_type" required:"true"`
  83. }
  84. type PutBucketDecompressPolicyOutput struct {
  85. Metadata map[string]*string `location:"headers" type:"map"`
  86. StatusCode *int64 `location:"statusCode" type:"integer"`
  87. }
  88. // GetBucketDecompressPolicyRequest generates a request for the GetBucketDecompressPolicy operation.
  89. func (c *S3) GetBucketDecompressPolicyRequest(input *GetBucketDecompressPolicyInput) (req *aws.Request, output *GetBucketDecompressPolicyOutput) {
  90. op := &aws.Operation{
  91. Name: "GetBucketDecompressPolicy",
  92. HTTPMethod: "GET",
  93. HTTPPath: "/{Bucket}?decompresspolicy",
  94. }
  95. if input == nil {
  96. input = &GetBucketDecompressPolicyInput{}
  97. }
  98. req = c.newRequest(op, input, output)
  99. req.ContentType = "application/json"
  100. output = &GetBucketDecompressPolicyOutput{
  101. BucketDecompressPolicy: &BucketDecompressPolicy{},
  102. }
  103. req.Data = output
  104. return
  105. }
  106. // GetBucketDecompressPolicy gets the decompression policy for the bucket.
  107. func (c *S3) GetBucketDecompressPolicy(input *GetBucketDecompressPolicyInput) (*GetBucketDecompressPolicyOutput, error) {
  108. req, out := c.GetBucketDecompressPolicyRequest(input)
  109. err := req.Send()
  110. return out, err
  111. }
  112. func (c *S3) GetBucketDecompressPolicyWithContext(ctx aws.Context, input *GetBucketDecompressPolicyInput) (*GetBucketDecompressPolicyOutput, error) {
  113. req, out := c.GetBucketDecompressPolicyRequest(input)
  114. req.SetContext(ctx)
  115. err := req.Send()
  116. return out, err
  117. }
  118. type GetBucketDecompressPolicyInput struct {
  119. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  120. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  121. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  122. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  123. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  124. }
  125. type GetBucketDecompressPolicyOutput struct {
  126. BucketDecompressPolicy *BucketDecompressPolicy `locationName:"BucketDecompressPolicy" type:"structure"`
  127. Metadata map[string]*string `location:"headers" type:"map"`
  128. StatusCode *int64 `location:"statusCode" type:"integer"`
  129. metadataGetBucketDecompressPolicyOutput `json:"-" xml:"-"`
  130. }
  131. type metadataGetBucketDecompressPolicyOutput struct {
  132. SDKShapeTraits bool `type:"structure" payload:"BucketDecompressPolicy"`
  133. }
  134. // DeleteBucketDecompressPolicyRequest generates a request for the DeleteBucketDecompressPolicy operation.
  135. func (c *S3) DeleteBucketDecompressPolicyRequest(input *DeleteBucketDecompressPolicyInput) (req *aws.Request, output *DeleteBucketDecompressPolicyOutput) {
  136. op := &aws.Operation{
  137. Name: "DeleteBucketDecompressPolicy",
  138. HTTPMethod: "DELETE",
  139. HTTPPath: "/{Bucket}?decompresspolicy",
  140. }
  141. if input == nil {
  142. input = &DeleteBucketDecompressPolicyInput{}
  143. }
  144. req = c.newRequest(op, input, output)
  145. output = &DeleteBucketDecompressPolicyOutput{}
  146. req.Data = output
  147. return
  148. }
  149. // DeleteBucketDecompressPolicy deletes the decompression policy for the bucket.
  150. func (c *S3) DeleteBucketDecompressPolicy(input *DeleteBucketDecompressPolicyInput) (*DeleteBucketDecompressPolicyOutput, error) {
  151. req, out := c.DeleteBucketDecompressPolicyRequest(input)
  152. err := req.Send()
  153. return out, err
  154. }
  155. func (c *S3) DeleteBucketDecompressPolicyWithContext(ctx aws.Context, input *DeleteBucketDecompressPolicyInput) (*DeleteBucketDecompressPolicyOutput, error) {
  156. req, out := c.DeleteBucketDecompressPolicyRequest(input)
  157. req.SetContext(ctx)
  158. err := req.Send()
  159. return out, err
  160. }
  161. type DeleteBucketDecompressPolicyInput struct {
  162. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  163. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  164. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  165. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  166. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  167. }
  168. type DeleteBucketDecompressPolicyOutput struct {
  169. Metadata map[string]*string `location:"headers" type:"map"`
  170. StatusCode *int64 `location:"statusCode" type:"integer"`
  171. }