How to remove v4 signature and add custom v2 signature in aws-sdk-go-v2 and Custom parsing return value?

86 views Asked by At

1.Since the object storage we are docking with only supports v2 signatures, I would like to replace v4 signatures with v2 signatures in aws-sdk-go-v2

2.The bucket creation time of the ListBucket stored in our docking object and the last modification time of the ListObject interface object are both in non s3 time format. How can I customize the processing of return value parsing in these two time formats

This is my current code

func NewS3V2Cli(endpoint, accessKey, secretKey, region string) *s3.Client {
    cfg, err := config.LoadDefaultConfig(context.Background(),
        config.WithCredentialsProvider(credentials.StaticCredentialsProvider{
            Value: aws.Credentials{
                AccessKeyID:     accessKey,
                SecretAccessKey: secretKey,
                SessionToken:    "",
            },
        }),
    )
    if err != nil {
        panic(err)
    }
    client := s3.NewFromConfig(cfg, func(o *s3.Options) {
        o.Region = region
        o.UsePathStyle = true
        if len(endpoint) > 0 {
            o.EndpointResolver = s3.EndpointResolverFromURL(endpoint)
        }
    })
    return client
}
0

There are 0 answers