1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3package swf 4 5import ( 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/jsonrpc" 12) 13 14// SWF provides the API operation methods for making requests to 15// Amazon Simple Workflow Service. See this package's package overview docs 16// for details on the service. 17// 18// SWF methods are safe to use concurrently. It is not safe to 19// modify mutate any of the struct's properties though. 20type SWF struct { 21 *client.Client 22} 23 24// Used for custom client initialization logic 25var initClient func(*client.Client) 26 27// Used for custom request initialization logic 28var initRequest func(*request.Request) 29 30// Service information constants 31const ( 32 ServiceName = "swf" // Name of service. 33 EndpointsID = ServiceName // ID to lookup a service endpoint with. 34 ServiceID = "SWF" // ServiceID is a unique identifier of a specific service. 35) 36 37// New creates a new instance of the SWF 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. 40// 41// Example: 42// mySession := session.Must(session.NewSession()) 43// 44// // Create a SWF client from just a session. 45// svc := swf.New(mySession) 46// 47// // Create a SWF client with additional configuration 48// svc := swf.New(mySession, aws.NewConfig().WithRegion("us-west-2")) 49func New(p client.ConfigProvider, cfgs ...*aws.Config) *SWF { 50 c := p.ClientConfig(EndpointsID, cfgs...) 51 return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName) 52} 53 54// newClient creates, initializes and returns a new service client instance. 55func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *SWF { 56 svc := &SWF{ 57 Client: client.New( 58 cfg, 59 metadata.ClientInfo{ 60 ServiceName: ServiceName, 61 ServiceID: ServiceID, 62 SigningName: signingName, 63 SigningRegion: signingRegion, 64 PartitionID: partitionID, 65 Endpoint: endpoint, 66 APIVersion: "2012-01-25", 67 JSONVersion: "1.0", 68 TargetPrefix: "SimpleWorkflowService", 69 }, 70 handlers, 71 ), 72 } 73 74 // Handlers 75 svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) 76 svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) 77 svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) 78 svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) 79 svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) 80 81 // Run custom client initialization if present 82 if initClient != nil { 83 initClient(svc.Client) 84 } 85 86 return svc 87} 88 89// newRequest creates a new request for a SWF operation and runs any 90// custom request initialization. 91func (c *SWF) newRequest(op *request.Operation, params, data interface{}) *request.Request { 92 req := c.NewRequest(op, params, data) 93 94 // Run custom request initialization if present 95 if initRequest != nil { 96 initRequest(req) 97 } 98 99 return req 100} 101