service.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package databasemigrationservice
  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. // AWS Database Migration Service (AWS DMS) can migrate your data to and from
  12. // the most widely used commercial and open-source databases such as Oracle,
  13. // PostgreSQL, Microsoft SQL Server, Amazon Redshift, MariaDB, Amazon Aurora,
  14. // and MySQL. The service supports homogeneous migrations such as Oracle to
  15. // Oracle, as well as heterogeneous migrations between different database platforms,
  16. // such as Oracle to MySQL or SQL Server to PostgreSQL.
  17. //The service client's operations are safe to be used concurrently.
  18. // It is not safe to mutate any of the client's properties though.
  19. type DatabaseMigrationService struct {
  20. *client.Client
  21. }
  22. // Used for custom client initialization logic
  23. var initClient func(*client.Client)
  24. // Used for custom request initialization logic
  25. var initRequest func(*request.Request)
  26. // A ServiceName is the name of the service the client will make API calls to.
  27. const ServiceName = "dms"
  28. // New creates a new instance of the DatabaseMigrationService client with a session.
  29. // If additional configuration is needed for the client instance use the optional
  30. // aws.Config parameter to add your extra config.
  31. //
  32. // Example:
  33. // // Create a DatabaseMigrationService client from just a session.
  34. // svc := databasemigrationservice.New(mySession)
  35. //
  36. // // Create a DatabaseMigrationService client with additional configuration
  37. // svc := databasemigrationservice.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  38. func New(p client.ConfigProvider, cfgs ...*aws.Config) *DatabaseMigrationService {
  39. c := p.ClientConfig(ServiceName, cfgs...)
  40. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  41. }
  42. // newClient creates, initializes and returns a new service client instance.
  43. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *DatabaseMigrationService {
  44. svc := &DatabaseMigrationService{
  45. Client: client.New(
  46. cfg,
  47. metadata.ClientInfo{
  48. ServiceName: ServiceName,
  49. SigningRegion: signingRegion,
  50. Endpoint: endpoint,
  51. APIVersion: "2016-01-01",
  52. JSONVersion: "1.1",
  53. TargetPrefix: "AmazonDMSv20160101",
  54. },
  55. handlers,
  56. ),
  57. }
  58. // Handlers
  59. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  60. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  61. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  62. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  63. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  64. // Run custom client initialization if present
  65. if initClient != nil {
  66. initClient(svc.Client)
  67. }
  68. return svc
  69. }
  70. // newRequest creates a new request for a DatabaseMigrationService operation and runs any
  71. // custom request initialization.
  72. func (c *DatabaseMigrationService) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  73. req := c.NewRequest(op, params, data)
  74. // Run custom request initialization if present
  75. if initRequest != nil {
  76. initRequest(req)
  77. }
  78. return req
  79. }