File: customizations.go

package info (click to toggle)
golang-github-aws-aws-sdk-go 1.49.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 312,636 kB
  • sloc: makefile: 120
file content (54 lines) | stat: -rw-r--r-- 1,667 bytes parent folder | download | duplicates (2)
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
45
46
47
48
49
50
51
52
53
54
package s3control

import (
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/client"
	"github.com/aws/aws-sdk-go/aws/endpoints"
	"github.com/aws/aws-sdk-go/aws/request"
	"github.com/aws/aws-sdk-go/internal/s3shared/arn"
	"github.com/aws/aws-sdk-go/internal/s3shared/s3err"
)

func init() {
	initClient = defaultInitClientFn
}

func defaultInitClientFn(c *client.Client) {
	if c.Config.UseDualStackEndpoint == endpoints.DualStackEndpointStateUnset {
		if aws.BoolValue(c.Config.UseDualStack) {
			c.Config.UseDualStackEndpoint = endpoints.DualStackEndpointStateEnabled
		} else {
			c.Config.UseDualStackEndpoint = endpoints.DualStackEndpointStateDisabled
		}
	}

	// Support building custom endpoints based on config
	c.Handlers.Build.PushFrontNamed(request.NamedHandler{
		Name: "s3ControlEndpointHandler",
		Fn:   endpointHandler,
	})

	// S3 uses custom error unmarshaling logic
	c.Handlers.UnmarshalError.PushBackNamed(s3err.RequestFailureWrapperHandler())
}

// endpointARNGetter is an accessor interface to grab the
// the field corresponding to an endpoint ARN input.
type endpointARNGetter interface {
	getEndpointARN() (arn.Resource, error)
	hasEndpointARN() bool
	updateArnableField(string) (interface{}, error)
}

// endpointOutpostIDGetter is an accessor interface to grab the
// the field corresponding to an outpost ID input.
type endpointOutpostIDGetter interface {
	getOutpostID() (string, error)
	hasOutpostID() bool
}

// accountIDValidator is an accessor interface to validate the
// account id member value and account id present in endpoint ARN.
type accountIDValidator interface {
	updateAccountID(string) (interface{}, error)
}