inventory.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. package s3
  2. import "github.com/ks3sdklib/aws-sdk-go/aws"
  3. // PutBucketInventoryRequest generates a request for the PutBucketInventory operation.
  4. func (c *S3) PutBucketInventoryRequest(input *PutBucketInventoryInput) (req *aws.Request, output *PutBucketInventoryOutput) {
  5. op := &aws.Operation{
  6. Name: "PutBucketInventory",
  7. HTTPMethod: "PUT",
  8. HTTPPath: "/{Bucket}?inventory",
  9. }
  10. if input == nil {
  11. input = &PutBucketInventoryInput{}
  12. }
  13. input.AutoFillMD5 = true
  14. req = c.newRequest(op, input, output)
  15. output = &PutBucketInventoryOutput{}
  16. req.Data = output
  17. return
  18. }
  19. // PutBucketInventory creates a new inventory configuration.
  20. func (c *S3) PutBucketInventory(input *PutBucketInventoryInput) (*PutBucketInventoryOutput, error) {
  21. req, out := c.PutBucketInventoryRequest(input)
  22. err := req.Send()
  23. return out, err
  24. }
  25. func (c *S3) PutBucketInventoryWithContext(ctx aws.Context, input *PutBucketInventoryInput) (*PutBucketInventoryOutput, error) {
  26. req, out := c.PutBucketInventoryRequest(input)
  27. req.SetContext(ctx)
  28. err := req.Send()
  29. return out, err
  30. }
  31. type PutBucketInventoryInput struct {
  32. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  33. Id *string `location:"querystring" locationName:"id" type:"string" required:"true"`
  34. InventoryConfiguration *InventoryConfiguration `locationName:"InventoryConfiguration" type:"structure" required:"true"`
  35. ContentType *string `location:"header" locationName:"Content-Type" type:"string"`
  36. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  37. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  38. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  39. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  40. metadataPutBucketInventoryInput `json:"-" xml:"-"`
  41. }
  42. type metadataPutBucketInventoryInput struct {
  43. SDKShapeTraits bool `type:"structure" payload:"InventoryConfiguration"`
  44. AutoFillMD5 bool
  45. }
  46. type PutBucketInventoryOutput struct {
  47. Metadata map[string]*string `location:"headers" type:"map"`
  48. StatusCode *int64 `location:"statusCode" type:"integer"`
  49. }
  50. type InventoryConfiguration struct {
  51. // The list name specified by the user is unique within a single bucket.
  52. Id *string `locationName:"Id" type:"string" required:"true"`
  53. // Is the inventory function enabled.
  54. IsEnabled *bool `locationName:"IsEnabled" type:"boolean" required:"true"`
  55. // Specify scanning prefix information.
  56. Filter *InventoryFilter `locationName:"Filter" type:"structure"`
  57. // Storage inventory results.
  58. Destination *Destination `locationName:"Destination" type:"structure" required:"true"`
  59. // Container for storing inventory export cycle information.
  60. Schedule *Schedule `locationName:"Schedule" type:"structure" required:"true"`
  61. // Set the configuration items included in the inventory results.
  62. OptionalFields *OptionalFields `locationName:"OptionalFields" type:"structure" required:"true"`
  63. }
  64. type InventoryFilter struct {
  65. // The storage path prefix of the inventory file.
  66. Prefix *string `locationName:"Prefix" type:"string" required:"true"`
  67. // The starting timestamp of the last modification time of the filtered file, in seconds.
  68. LastModifyBeginTimeStamp *string `locationName:"LastModifyBeginTimeStamp" type:"string"`
  69. // End timestamp of the last modification time of the filtered file, in seconds.
  70. LastModifyEndTimeStamp *string `locationName:"LastModifyEndTimeStamp" type:"string"`
  71. }
  72. type Destination struct {
  73. // Bucket information stored after exporting the inventory results.
  74. KS3BucketDestination *KS3BucketDestination `locationName:"KS3BucketDestination" type:"structure" required:"true"`
  75. }
  76. type KS3BucketDestination struct {
  77. // The file format of the inventory file is a CSV file compressed using GZIP after exporting the manifest file.
  78. Format *string `locationName:"Format" type:"string" required:"true"`
  79. // Bucket owner's account ID.
  80. AccountId *string `locationName:"AccountId" type:"string"`
  81. // Bucket for storing exported inventory files.
  82. Bucket *string `locationName:"Bucket" type:"string" required:"true"`
  83. // The storage path prefix of the inventory file.
  84. Prefix *string `locationName:"Prefix" type:"string"`
  85. }
  86. type Schedule struct {
  87. // Cycle of exporting inventory files.
  88. Frequency *string `locationName:"Frequency" type:"string" required:"true"`
  89. }
  90. type OptionalFields struct {
  91. // Configuration items included in the inventory results.
  92. // Valid values:
  93. // Size: The size of the object.
  94. // LastModifiedDate: The last modified time of an object.
  95. // ETag: The ETag value of an object, used to identify its contents.
  96. // StorageClass: The storage type of Object.
  97. // IsMultipartUploaded: Is it an object uploaded through shard upload method.
  98. // EncryptionStatus: Whether the object is encrypted. If the object is encrypted, the value of this field is True; otherwise, it is False.
  99. Field []*string `locationName:"Field" type:"list" flattened:"true"`
  100. }
  101. // GetBucketInventoryRequest generates a request for the GetBucketInventory operation.
  102. func (c *S3) GetBucketInventoryRequest(input *GetBucketInventoryInput) (req *aws.Request, output *GetBucketInventoryOutput) {
  103. op := &aws.Operation{
  104. Name: "GetBucketInventory",
  105. HTTPMethod: "GET",
  106. HTTPPath: "/{Bucket}?inventory",
  107. }
  108. if input == nil {
  109. input = &GetBucketInventoryInput{}
  110. }
  111. req = c.newRequest(op, input, output)
  112. output = &GetBucketInventoryOutput{}
  113. req.Data = output
  114. return
  115. }
  116. // GetBucketInventory gets the inventory configuration for the bucket.
  117. func (c *S3) GetBucketInventory(input *GetBucketInventoryInput) (*GetBucketInventoryOutput, error) {
  118. req, out := c.GetBucketInventoryRequest(input)
  119. err := req.Send()
  120. return out, err
  121. }
  122. func (c *S3) GetBucketInventoryWithContext(ctx aws.Context, input *GetBucketInventoryInput) (*GetBucketInventoryOutput, error) {
  123. req, out := c.GetBucketInventoryRequest(input)
  124. req.SetContext(ctx)
  125. err := req.Send()
  126. return out, err
  127. }
  128. type GetBucketInventoryInput struct {
  129. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  130. Id *string `location:"querystring" locationName:"id" type:"string" required:"true"`
  131. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  132. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  133. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  134. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  135. }
  136. type GetBucketInventoryOutput struct {
  137. InventoryConfiguration *InventoryConfiguration `locationName:"Inventory" type:"structure"`
  138. Metadata map[string]*string `location:"headers" type:"map"`
  139. StatusCode *int64 `location:"statusCode" type:"integer"`
  140. metadataGetBucketInventoryOutput `json:"-" xml:"-"`
  141. }
  142. type metadataGetBucketInventoryOutput struct {
  143. SDKShapeTraits bool `type:"structure" payload:"InventoryConfiguration"`
  144. }
  145. // DeleteBucketInventoryRequest generates a request for the DeleteBucketInventory operation.
  146. func (c *S3) DeleteBucketInventoryRequest(input *DeleteBucketInventoryInput) (req *aws.Request, output *DeleteBucketInventoryOutput) {
  147. op := &aws.Operation{
  148. Name: "DeleteBucketInventory",
  149. HTTPMethod: "DELETE",
  150. HTTPPath: "/{Bucket}?inventory",
  151. }
  152. if input == nil {
  153. input = &DeleteBucketInventoryInput{}
  154. }
  155. req = c.newRequest(op, input, output)
  156. output = &DeleteBucketInventoryOutput{}
  157. req.Data = output
  158. return
  159. }
  160. // DeleteBucketInventory deletes the inventory configuration for the bucket.
  161. func (c *S3) DeleteBucketInventory(input *DeleteBucketInventoryInput) (*DeleteBucketInventoryOutput, error) {
  162. req, out := c.DeleteBucketInventoryRequest(input)
  163. err := req.Send()
  164. return out, err
  165. }
  166. func (c *S3) DeleteBucketInventoryWithContext(ctx aws.Context, input *DeleteBucketInventoryInput) (*DeleteBucketInventoryOutput, error) {
  167. req, out := c.DeleteBucketInventoryRequest(input)
  168. req.SetContext(ctx)
  169. err := req.Send()
  170. return out, err
  171. }
  172. type DeleteBucketInventoryInput struct {
  173. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  174. Id *string `location:"querystring" locationName:"id" type:"string" required:"true"`
  175. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  176. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  177. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  178. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  179. }
  180. type DeleteBucketInventoryOutput struct {
  181. Metadata map[string]*string `location:"headers" type:"map"`
  182. StatusCode *int64 `location:"statusCode" type:"integer"`
  183. }
  184. // ListBucketInventoryRequest generates a request for the ListBucketInventory operation.
  185. func (c *S3) ListBucketInventoryRequest(input *ListBucketInventoryInput) (req *aws.Request, output *ListBucketInventoryOutput) {
  186. op := &aws.Operation{
  187. Name: "ListBucketInventory",
  188. HTTPMethod: "GET",
  189. HTTPPath: "/{Bucket}?inventory",
  190. }
  191. if input == nil {
  192. input = &ListBucketInventoryInput{}
  193. }
  194. req = c.newRequest(op, input, output)
  195. output = &ListBucketInventoryOutput{}
  196. req.Data = output
  197. return
  198. }
  199. // ListBucketInventory lists the inventory configurations for the bucket.
  200. func (c *S3) ListBucketInventory(input *ListBucketInventoryInput) (*ListBucketInventoryOutput, error) {
  201. req, out := c.ListBucketInventoryRequest(input)
  202. err := req.Send()
  203. return out, err
  204. }
  205. func (c *S3) ListBucketInventoryWithContext(ctx aws.Context, input *ListBucketInventoryInput) (*ListBucketInventoryOutput, error) {
  206. req, out := c.ListBucketInventoryRequest(input)
  207. req.SetContext(ctx)
  208. err := req.Send()
  209. return out, err
  210. }
  211. type ListBucketInventoryInput struct {
  212. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  213. ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"`
  214. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  215. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  216. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  217. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  218. }
  219. type ListInventoryConfigurationsResult struct {
  220. InventoryConfigurations []*InventoryConfiguration `locationName:"InventoryConfiguration" type:"list" flattened:"true"`
  221. IsTruncated *bool `locationName:"IsTruncated" type:"boolean"`
  222. NextContinuationToken *string `locationName:"NextContinuationToken" type:"string"`
  223. }
  224. type ListBucketInventoryOutput struct {
  225. InventoryConfigurationsResult *ListInventoryConfigurationsResult `locationName:"InventoryConfigurationsResult" type:"structure"`
  226. Metadata map[string]*string `location:"headers" type:"map"`
  227. StatusCode *int64 `location:"statusCode" type:"integer"`
  228. metadataListBucketInventoryOutput `json:"-" xml:"-"`
  229. }
  230. type metadataListBucketInventoryOutput struct {
  231. SDKShapeTraits bool `type:"structure" payload:"InventoryConfigurationsResult"`
  232. }