service.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package swf
  3. import (
  4. "github.com/aws/aws-sdk-go/aws"
  5. "github.com/aws/aws-sdk-go/aws/client"
  6. "github.com/aws/aws-sdk-go/aws/client/metadata"
  7. "github.com/aws/aws-sdk-go/aws/request"
  8. "github.com/aws/aws-sdk-go/aws/signer/v4"
  9. "github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
  10. )
  11. // The Amazon Simple Workflow Service (Amazon SWF) makes it easy to build applications
  12. // that use Amazon's cloud to coordinate work across distributed components.
  13. // In Amazon SWF, a task represents a logical unit of work that is performed
  14. // by a component of your workflow. Coordinating tasks in a workflow involves
  15. // managing intertask dependencies, scheduling, and concurrency in accordance
  16. // with the logical flow of the application.
  17. //
  18. // Amazon SWF gives you full control over implementing tasks and coordinating
  19. // them without worrying about underlying complexities such as tracking their
  20. // progress and maintaining their state.
  21. //
  22. // This documentation serves as reference only. For a broader overview of the
  23. // Amazon SWF programming model, see the Amazon SWF Developer Guide (http://docs.aws.amazon.com/amazonswf/latest/developerguide/).
  24. //The service client's operations are safe to be used concurrently.
  25. // It is not safe to mutate any of the client's properties though.
  26. type SWF struct {
  27. *client.Client
  28. }
  29. // Used for custom client initialization logic
  30. var initClient func(*client.Client)
  31. // Used for custom request initialization logic
  32. var initRequest func(*request.Request)
  33. // A ServiceName is the name of the service the client will make API calls to.
  34. const ServiceName = "swf"
  35. // New creates a new instance of the SWF client with a session.
  36. // If additional configuration is needed for the client instance use the optional
  37. // aws.Config parameter to add your extra config.
  38. //
  39. // Example:
  40. // // Create a SWF client from just a session.
  41. // svc := swf.New(mySession)
  42. //
  43. // // Create a SWF client with additional configuration
  44. // svc := swf.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  45. func New(p client.ConfigProvider, cfgs ...*aws.Config) *SWF {
  46. c := p.ClientConfig(ServiceName, cfgs...)
  47. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  48. }
  49. // newClient creates, initializes and returns a new service client instance.
  50. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *SWF {
  51. svc := &SWF{
  52. Client: client.New(
  53. cfg,
  54. metadata.ClientInfo{
  55. ServiceName: ServiceName,
  56. SigningRegion: signingRegion,
  57. Endpoint: endpoint,
  58. APIVersion: "2012-01-25",
  59. JSONVersion: "1.0",
  60. TargetPrefix: "SimpleWorkflowService",
  61. },
  62. handlers,
  63. ),
  64. }
  65. // Handlers
  66. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  67. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  68. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  69. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  70. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  71. // Run custom client initialization if present
  72. if initClient != nil {
  73. initClient(svc.Client)
  74. }
  75. return svc
  76. }
  77. // newRequest creates a new request for a SWF operation and runs any
  78. // custom request initialization.
  79. func (c *SWF) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  80. req := c.NewRequest(op, params, data)
  81. // Run custom request initialization if present
  82. if initRequest != nil {
  83. initRequest(req)
  84. }
  85. return req
  86. }