service.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package elasticache
  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/query"
  10. )
  11. // Amazon ElastiCache is a web service that makes it easier to set up, operate,
  12. // and scale a distributed cache in the cloud.
  13. //
  14. // With ElastiCache, customers get all of the benefits of a high-performance,
  15. // in-memory cache with less of the administrative burden involved in launching
  16. // and managing a distributed cache. The service makes setup, scaling, and cluster
  17. // failure handling much simpler than in a self-managed cache deployment.
  18. //
  19. // In addition, through integration with Amazon CloudWatch, customers get enhanced
  20. // visibility into the key performance statistics associated with their cache
  21. // and can receive alarms if a part of their cache runs hot.
  22. //The service client's operations are safe to be used concurrently.
  23. // It is not safe to mutate any of the client's properties though.
  24. type ElastiCache struct {
  25. *client.Client
  26. }
  27. // Used for custom client initialization logic
  28. var initClient func(*client.Client)
  29. // Used for custom request initialization logic
  30. var initRequest func(*request.Request)
  31. // A ServiceName is the name of the service the client will make API calls to.
  32. const ServiceName = "elasticache"
  33. // New creates a new instance of the ElastiCache client with a session.
  34. // If additional configuration is needed for the client instance use the optional
  35. // aws.Config parameter to add your extra config.
  36. //
  37. // Example:
  38. // // Create a ElastiCache client from just a session.
  39. // svc := elasticache.New(mySession)
  40. //
  41. // // Create a ElastiCache client with additional configuration
  42. // svc := elasticache.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  43. func New(p client.ConfigProvider, cfgs ...*aws.Config) *ElastiCache {
  44. c := p.ClientConfig(ServiceName, cfgs...)
  45. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  46. }
  47. // newClient creates, initializes and returns a new service client instance.
  48. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *ElastiCache {
  49. svc := &ElastiCache{
  50. Client: client.New(
  51. cfg,
  52. metadata.ClientInfo{
  53. ServiceName: ServiceName,
  54. SigningRegion: signingRegion,
  55. Endpoint: endpoint,
  56. APIVersion: "2015-02-02",
  57. },
  58. handlers,
  59. ),
  60. }
  61. // Handlers
  62. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  63. svc.Handlers.Build.PushBackNamed(query.BuildHandler)
  64. svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
  65. svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
  66. svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
  67. // Run custom client initialization if present
  68. if initClient != nil {
  69. initClient(svc.Client)
  70. }
  71. return svc
  72. }
  73. // newRequest creates a new request for a ElastiCache operation and runs any
  74. // custom request initialization.
  75. func (c *ElastiCache) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  76. req := c.NewRequest(op, params, data)
  77. // Run custom request initialization if present
  78. if initRequest != nil {
  79. initRequest(req)
  80. }
  81. return req
  82. }