MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / createObject

Method createObject

plugins/destination/s3/client/write.go:26–49  ·  view source on GitHub ↗
(ctx context.Context, table *schema.Table, objKey string)

Source from the content-addressed store, hash-verified

24var reInvalidJSONKey = regexp.MustCompile(`\W`)
25
26func (c *Client) createObject(ctx context.Context, table *schema.Table, objKey string) (*filetypes.Stream, error) {
27 s, err := c.Client.StartStream(table, func(r io.Reader) error {
28 params := &transfermanager.UploadObjectInput{
29 Bucket: aws.String(c.spec.Bucket),
30 Key: aws.String(objKey),
31 Body: r,
32 ContentType: aws.String(c.spec.GetContentType()),
33 }
34
35 if c.spec.ACL != "" {
36 params.ACL = tmtypes.ObjectCannedACL(c.spec.ACL)
37 }
38
39 sseConfiguration := c.spec.ServerSideEncryptionConfiguration
40 if sseConfiguration != nil {
41 params.SSEKMSKeyID = &sseConfiguration.SSEKMSKeyId
42 params.ServerSideEncryption = tmtypes.ServerSideEncryption(sseConfiguration.ServerSideEncryption)
43 }
44
45 _, err := c.transferManager.UploadObject(ctx, params)
46 return err
47 })
48 return s, err
49}
50
51func (c *Client) WriteTable(ctx context.Context, msgs <-chan *message.WriteInsert) error {
52 var s *filetypes.Stream

Callers 2

WriteTableMethod · 0.95
MigrateTableMethod · 0.95

Calls 2

GetContentTypeMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected