service.go 4.1 KB

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