You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: s3.go
    path of file: ./repos/risingwave/integration_tests/datagen/sink/s3
    
    the code of the file until where you have to start completion: package s3

import (
	"bytes"
	"context"
	"datagen/sink"
	"fmt"
	"time"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/s3"
)

type S3Config struct {
	Bucket   string
	Region   string
	Endpoint string
}

type S3Sink struct {
	buffer bytes.Buffer
	client *s3.S3
	cfg    S3Config
}

func OpenS3Sink(cfg S3Config) (*S3Sink, error) {
	ss := session.Must(session.NewSession())
	config := aw
    
func (p *S3Sink) Flush(ctx context.Context) error {
	name := fmt.Sprintf("data-%d", time.Now().UnixMilli())

	_, err := p.client.PutObjectWithContext(ctx, &s3.PutObjectInput{
		Bucket: aws.String(p.cfg.Bucket),
		Key:    aws.String(name),
		Body:   bytes.NewReader(p.buffer.Bytes()),
	})
	if err != nil {
		return fmt.Errorf("failed to put object to s3: %s", err)
	}

	fmt.Printf("S3 Sink: uploaded object '%s' (%d bytes)\n", name, p.buffer.Len())

	p.buffer.Reset()
	return nil
}