1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
6 "github.com/aws/aws-sdk-go/aws"
7 "github.com/aws/aws-sdk-go/aws/client"
8 "github.com/aws/aws-sdk-go/aws/client/metadata"
9 "github.com/aws/aws-sdk-go/aws/request"
10 "github.com/aws/aws-sdk-go/aws/signer/v4"
11 "github.com/aws/aws-sdk-go/private/protocol/restxml"
14 // S3 provides the API operation methods for making requests to
15 // Amazon Simple Storage Service. See this package's package overview docs
16 // for details on the service.
18 // S3 methods are safe to use concurrently. It is not safe to
19 // modify mutate any of the struct's properties though.
24 // Used for custom client initialization logic
25 var initClient func(*client.Client)
27 // Used for custom request initialization logic
28 var initRequest func(*request.Request)
30 // Service information constants
32 ServiceName = "s3" // Name of service.
33 EndpointsID = ServiceName // ID to lookup a service endpoint with.
34 ServiceID = "S3" // ServiceID is a unique identifer of a specific service.
37 // New creates a new instance of the S3 client with a session.
38 // If additional configuration is needed for the client instance use the optional
39 // aws.Config parameter to add your extra config.
42 // // Create a S3 client from just a session.
43 // svc := s3.New(mySession)
45 // // Create a S3 client with additional configuration
46 // svc := s3.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
47 func New(p client.ConfigProvider, cfgs ...*aws.Config) *S3 {
48 c := p.ClientConfig(EndpointsID, cfgs...)
49 return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
52 // newClient creates, initializes and returns a new service client instance.
53 func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *S3 {
58 ServiceName: ServiceName,
60 SigningName: signingName,
61 SigningRegion: signingRegion,
63 APIVersion: "2006-03-01",
70 svc.Handlers.Sign.PushBackNamed(v4.BuildNamedHandler(v4.SignRequestHandler.Name, func(s *v4.Signer) {
71 s.DisableURIPathEscaping = true
73 svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
74 svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
75 svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
76 svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
78 svc.Handlers.UnmarshalStream.PushBackNamed(restxml.UnmarshalHandler)
80 // Run custom client initialization if present
81 if initClient != nil {
82 initClient(svc.Client)
88 // newRequest creates a new request for a S3 operation and runs any
89 // custom request initialization.
90 func (c *S3) newRequest(op *request.Operation, params, data interface{}) *request.Request {
91 req := c.NewRequest(op, params, data)
93 // Run custom request initialization if present
94 if initRequest != nil {