bucket_encryption.go 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. package s3
  2. import (
  3. "github.com/ks3sdklib/aws-sdk-go/aws"
  4. )
  5. type PutBucketEncryptionInput struct {
  6. // The name of the bucket.
  7. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  8. // Bucket encryption configuration container.
  9. ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `locationName:"ServerSideEncryptionConfiguration" type:"structure" required:"true"`
  10. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  11. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  12. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  13. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  14. metadataPutBucketEncryptionInput `json:"-" xml:"-"`
  15. }
  16. type metadataPutBucketEncryptionInput struct {
  17. SDKShapeTraits bool `type:"structure" payload:"ServerSideEncryptionConfiguration"`
  18. AutoFillMD5 bool
  19. }
  20. type ServerSideEncryptionConfiguration struct {
  21. // Default encryption rule for bucket.
  22. Rule *BucketEncryptionRule `locationName:"Rule" type:"structure" required:"true"`
  23. }
  24. type BucketEncryptionRule struct {
  25. // The child element of the default encryption configuration for the bucket.
  26. ApplyServerSideEncryptionByDefault *ApplyServerSideEncryptionByDefault `locationName:"ApplyServerSideEncryptionByDefault" type:"structure" required:"true"`
  27. }
  28. type ApplyServerSideEncryptionByDefault struct {
  29. // The server-side encryption algorithm to be used by the bucket's default encryption configuration.
  30. SSEAlgorithm *string `locationName:"SSEAlgorithm" type:"string" required:"true"`
  31. }
  32. type PutBucketEncryptionOutput struct {
  33. // The HTTP headers of the response.
  34. Metadata map[string]*string `location:"headers" type:"map"`
  35. // The HTTP status code of the response.
  36. StatusCode *int64 `location:"statusCode" type:"integer"`
  37. }
  38. // PutBucketEncryptionRequest generates a request for the PutBucketEncryption operation.
  39. func (c *S3) PutBucketEncryptionRequest(input *PutBucketEncryptionInput) (req *aws.Request, output *PutBucketEncryptionOutput) {
  40. op := &aws.Operation{
  41. Name: "PutBucketEncryption",
  42. HTTPMethod: "PUT",
  43. HTTPPath: "/{Bucket}?encryption",
  44. }
  45. if input == nil {
  46. input = &PutBucketEncryptionInput{}
  47. }
  48. input.AutoFillMD5 = true
  49. req = c.newRequest(op, input, output)
  50. output = &PutBucketEncryptionOutput{}
  51. req.Data = output
  52. return
  53. }
  54. // PutBucketEncryption sets bucket encryption configuration.
  55. func (c *S3) PutBucketEncryption(input *PutBucketEncryptionInput) (*PutBucketEncryptionOutput, error) {
  56. req, out := c.PutBucketEncryptionRequest(input)
  57. err := req.Send()
  58. return out, err
  59. }
  60. func (c *S3) PutBucketEncryptionWithContext(ctx aws.Context, input *PutBucketEncryptionInput) (*PutBucketEncryptionOutput, error) {
  61. req, out := c.PutBucketEncryptionRequest(input)
  62. req.SetContext(ctx)
  63. err := req.Send()
  64. return out, err
  65. }
  66. type GetBucketEncryptionInput struct {
  67. // The name of the bucket.
  68. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  69. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  70. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  71. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  72. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  73. }
  74. type GetBucketEncryptionOutput struct {
  75. // Bucket encryption configuration container.
  76. ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `locationName:"ServerSideEncryptionConfiguration" type:"structure"`
  77. // The HTTP headers of the response.
  78. Metadata map[string]*string `location:"headers" type:"map"`
  79. // The HTTP status code of the response.
  80. StatusCode *int64 `location:"statusCode" type:"integer"`
  81. metadataGetBucketEncryptionOutput `json:"-" xml:"-"`
  82. }
  83. type metadataGetBucketEncryptionOutput struct {
  84. SDKShapeTraits bool `type:"structure" payload:"ServerSideEncryptionConfiguration"`
  85. }
  86. // GetBucketEncryptionRequest generates a request for the GetBucketEncryption operation.
  87. func (c *S3) GetBucketEncryptionRequest(input *GetBucketEncryptionInput) (req *aws.Request, output *GetBucketEncryptionOutput) {
  88. op := &aws.Operation{
  89. Name: "GetBucketEncryption",
  90. HTTPMethod: "GET",
  91. HTTPPath: "/{Bucket}?encryption",
  92. }
  93. if input == nil {
  94. input = &GetBucketEncryptionInput{}
  95. }
  96. req = c.newRequest(op, input, output)
  97. output = &GetBucketEncryptionOutput{}
  98. req.Data = output
  99. return
  100. }
  101. // GetBucketEncryption gets bucket encryption configuration.
  102. func (c *S3) GetBucketEncryption(input *GetBucketEncryptionInput) (*GetBucketEncryptionOutput, error) {
  103. req, out := c.GetBucketEncryptionRequest(input)
  104. err := req.Send()
  105. return out, err
  106. }
  107. func (c *S3) GetBucketEncryptionWithContext(ctx aws.Context, input *GetBucketEncryptionInput) (*GetBucketEncryptionOutput, error) {
  108. req, out := c.GetBucketEncryptionRequest(input)
  109. req.SetContext(ctx)
  110. err := req.Send()
  111. return out, err
  112. }
  113. type DeleteBucketEncryptionInput struct {
  114. // The name of the bucket.
  115. Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`
  116. // Set extend request headers. If the existing fields do not support setting the request header you need, you can set it through this field.
  117. ExtendHeaders map[string]*string `location:"extendHeaders" type:"map"`
  118. // Set extend query params. If the existing fields do not support setting the query param you need, you can set it through this field.
  119. ExtendQueryParams map[string]*string `location:"extendQueryParams" type:"map"`
  120. }
  121. type DeleteBucketEncryptionOutput struct {
  122. // The HTTP headers of the response.
  123. Metadata map[string]*string `location:"headers" type:"map"`
  124. // The HTTP status code of the response.
  125. StatusCode *int64 `location:"statusCode" type:"integer"`
  126. }
  127. // DeleteBucketEncryptionRequest generates a request for the DeleteBucketEncryption operation.
  128. func (c *S3) DeleteBucketEncryptionRequest(input *DeleteBucketEncryptionInput) (req *aws.Request, output *DeleteBucketEncryptionOutput) {
  129. op := &aws.Operation{
  130. Name: "DeleteBucketEncryption",
  131. HTTPMethod: "DELETE",
  132. HTTPPath: "/{Bucket}?encryption",
  133. }
  134. if input == nil {
  135. input = &DeleteBucketEncryptionInput{}
  136. }
  137. req = c.newRequest(op, input, output)
  138. output = &DeleteBucketEncryptionOutput{}
  139. req.Data = output
  140. return
  141. }
  142. // DeleteBucketEncryption deletes bucket encryption configuration.
  143. func (c *S3) DeleteBucketEncryption(input *DeleteBucketEncryptionInput) (*DeleteBucketEncryptionOutput, error) {
  144. req, out := c.DeleteBucketEncryptionRequest(input)
  145. err := req.Send()
  146. return out, err
  147. }
  148. func (c *S3) DeleteBucketEncryptionWithContext(ctx aws.Context, input *DeleteBucketEncryptionInput) (*DeleteBucketEncryptionOutput, error) {
  149. req, out := c.DeleteBucketEncryptionRequest(input)
  150. req.SetContext(ctx)
  151. err := req.Send()
  152. return out, err
  153. }