service.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package redshift
  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. // Overview
  12. //
  13. // This is an interface reference for Amazon Redshift. It contains documentation
  14. // for one of the programming or command line interfaces you can use to manage
  15. // Amazon Redshift clusters. Note that Amazon Redshift is asynchronous, which
  16. // means that some interfaces may require techniques, such as polling or asynchronous
  17. // callback handlers, to determine when a command has been applied. In this
  18. // reference, the parameter descriptions indicate whether a change is applied
  19. // immediately, on the next instance reboot, or during the next maintenance
  20. // window. For a summary of the Amazon Redshift cluster management interfaces,
  21. // go to Using the Amazon Redshift Management Interfaces (http://docs.aws.amazon.com/redshift/latest/mgmt/using-aws-sdk.html).
  22. //
  23. // Amazon Redshift manages all the work of setting up, operating, and scaling
  24. // a data warehouse: provisioning capacity, monitoring and backing up the cluster,
  25. // and applying patches and upgrades to the Amazon Redshift engine. You can
  26. // focus on using your data to acquire new insights for your business and customers.
  27. //
  28. // If you are a first-time user of Amazon Redshift, we recommend that you begin
  29. // by reading the Amazon Redshift Getting Started Guide (http://docs.aws.amazon.com/redshift/latest/gsg/getting-started.html).
  30. //
  31. // If you are a database developer, the Amazon Redshift Database Developer Guide
  32. // (http://docs.aws.amazon.com/redshift/latest/dg/welcome.html) explains how
  33. // to design, build, query, and maintain the databases that make up your data
  34. // warehouse.
  35. //The service client's operations are safe to be used concurrently.
  36. // It is not safe to mutate any of the client's properties though.
  37. type Redshift struct {
  38. *client.Client
  39. }
  40. // Used for custom client initialization logic
  41. var initClient func(*client.Client)
  42. // Used for custom request initialization logic
  43. var initRequest func(*request.Request)
  44. // A ServiceName is the name of the service the client will make API calls to.
  45. const ServiceName = "redshift"
  46. // New creates a new instance of the Redshift client with a session.
  47. // If additional configuration is needed for the client instance use the optional
  48. // aws.Config parameter to add your extra config.
  49. //
  50. // Example:
  51. // // Create a Redshift client from just a session.
  52. // svc := redshift.New(mySession)
  53. //
  54. // // Create a Redshift client with additional configuration
  55. // svc := redshift.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  56. func New(p client.ConfigProvider, cfgs ...*aws.Config) *Redshift {
  57. c := p.ClientConfig(ServiceName, cfgs...)
  58. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  59. }
  60. // newClient creates, initializes and returns a new service client instance.
  61. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *Redshift {
  62. svc := &Redshift{
  63. Client: client.New(
  64. cfg,
  65. metadata.ClientInfo{
  66. ServiceName: ServiceName,
  67. SigningRegion: signingRegion,
  68. Endpoint: endpoint,
  69. APIVersion: "2012-12-01",
  70. },
  71. handlers,
  72. ),
  73. }
  74. // Handlers
  75. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  76. svc.Handlers.Build.PushBackNamed(query.BuildHandler)
  77. svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
  78. svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
  79. svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
  80. // Run custom client initialization if present
  81. if initClient != nil {
  82. initClient(svc.Client)
  83. }
  84. return svc
  85. }
  86. // newRequest creates a new request for a Redshift operation and runs any
  87. // custom request initialization.
  88. func (c *Redshift) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  89. req := c.NewRequest(op, params, data)
  90. // Run custom request initialization if present
  91. if initRequest != nil {
  92. initRequest(req)
  93. }
  94. return req
  95. }