File: express_resolve.go

package info (click to toggle)
golang-github-aws-aws-sdk-go-v2 1.24.1-2~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 554,032 kB
  • sloc: java: 15,941; makefile: 419; sh: 175
file content (44 lines) | stat: -rw-r--r-- 1,476 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package s3

import (
	"github.com/aws/aws-sdk-go-v2/aws"
	"github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations"
)

// If the caller hasn't provided an S3Express provider, we use our default
// which will grab a reference to the S3 client itself in finalization.
func resolveExpressCredentials(o *Options) {
	if o.ExpressCredentials == nil {
		o.ExpressCredentials = newDefaultS3ExpressCredentialsProvider()
	}
}

// Config finalizer: if we're using the default S3Express implementation, grab
// a reference to the client for its CreateSession API, and the underlying
// sigv4 credentials provider for cache keying.
func finalizeExpressCredentials(o *Options, c *Client) {
	if p, ok := o.ExpressCredentials.(*defaultS3ExpressCredentialsProvider); ok {
		p.client = c
		p.v4creds = o.Credentials
	}
}

// Operation config finalizer: update the sigv4 credentials on the default
// express provider if it changed to ensure different cache keys
func finalizeOperationExpressCredentials(o *Options, c Client) {
	p, ok := o.ExpressCredentials.(*defaultS3ExpressCredentialsProvider)
	if !ok {
		return
	}

	if c.options.Credentials != o.Credentials {
		o.ExpressCredentials = p.CloneWithBaseCredentials(o.Credentials)
	}
}

// NewFromConfig resolver: pull from opaque sources if it exists.
func resolveDisableExpressAuth(cfg aws.Config, o *Options) {
	if v, ok := customizations.ResolveDisableExpressAuth(cfg.ConfigSources); ok {
		o.DisableS3ExpressSessionAuth = &v
	}
}