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/query"
14 // STS provides the API operation methods for making requests to
15 // AWS Security Token Service. See this package's package overview docs
16 // for details on the service.
18 // STS 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 = "sts" // Service endpoint prefix API calls made to.
33 EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
36 // New creates a new instance of the STS client with a session.
37 // If additional configuration is needed for the client instance use the optional
38 // aws.Config parameter to add your extra config.
41 // // Create a STS client from just a session.
42 // svc := sts.New(mySession)
44 // // Create a STS client with additional configuration
45 // svc := sts.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
46 func New(p client.ConfigProvider, cfgs ...*aws.Config) *STS {
47 c := p.ClientConfig(EndpointsID, cfgs...)
48 return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
51 // newClient creates, initializes and returns a new service client instance.
52 func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *STS {
57 ServiceName: ServiceName,
58 SigningName: signingName,
59 SigningRegion: signingRegion,
61 APIVersion: "2011-06-15",
68 svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
69 svc.Handlers.Build.PushBackNamed(query.BuildHandler)
70 svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
71 svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
72 svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
74 // Run custom client initialization if present
75 if initClient != nil {
76 initClient(svc.Client)
82 // newRequest creates a new request for a STS operation and runs any
83 // custom request initialization.
84 func (c *STS) newRequest(op *request.Operation, params, data interface{}) *request.Request {
85 req := c.NewRequest(op, params, data)
87 // Run custom request initialization if present
88 if initRequest != nil {