service.go 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package directconnect
  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 Direct Connect links your internal network to an AWS Direct Connect location
  12. // over a standard 1 gigabit or 10 gigabit Ethernet fiber-optic cable. One end
  13. // of the cable is connected to your router, the other to an AWS Direct Connect
  14. // router. With this connection in place, you can create virtual interfaces
  15. // directly to the AWS cloud (for example, to Amazon Elastic Compute Cloud (Amazon
  16. // EC2) and Amazon Simple Storage Service (Amazon S3)) and to Amazon Virtual
  17. // Private Cloud (Amazon VPC), bypassing Internet service providers in your
  18. // network path. An AWS Direct Connect location provides access to AWS in the
  19. // region it is associated with, as well as access to other US regions. For
  20. // example, you can provision a single connection to any AWS Direct Connect
  21. // location in the US and use it to access public AWS services in all US Regions
  22. // and AWS GovCloud (US).
  23. //The service client's operations are safe to be used concurrently.
  24. // It is not safe to mutate any of the client's properties though.
  25. type DirectConnect struct {
  26. *client.Client
  27. }
  28. // Used for custom client initialization logic
  29. var initClient func(*client.Client)
  30. // Used for custom request initialization logic
  31. var initRequest func(*request.Request)
  32. // A ServiceName is the name of the service the client will make API calls to.
  33. const ServiceName = "directconnect"
  34. // New creates a new instance of the DirectConnect client with a session.
  35. // If additional configuration is needed for the client instance use the optional
  36. // aws.Config parameter to add your extra config.
  37. //
  38. // Example:
  39. // // Create a DirectConnect client from just a session.
  40. // svc := directconnect.New(mySession)
  41. //
  42. // // Create a DirectConnect client with additional configuration
  43. // svc := directconnect.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  44. func New(p client.ConfigProvider, cfgs ...*aws.Config) *DirectConnect {
  45. c := p.ClientConfig(ServiceName, cfgs...)
  46. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  47. }
  48. // newClient creates, initializes and returns a new service client instance.
  49. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *DirectConnect {
  50. svc := &DirectConnect{
  51. Client: client.New(
  52. cfg,
  53. metadata.ClientInfo{
  54. ServiceName: ServiceName,
  55. SigningRegion: signingRegion,
  56. Endpoint: endpoint,
  57. APIVersion: "2012-10-25",
  58. JSONVersion: "1.1",
  59. TargetPrefix: "OvertureService",
  60. },
  61. handlers,
  62. ),
  63. }
  64. // Handlers
  65. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  66. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  67. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  68. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  69. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  70. // Run custom client initialization if present
  71. if initClient != nil {
  72. initClient(svc.Client)
  73. }
  74. return svc
  75. }
  76. // newRequest creates a new request for a DirectConnect operation and runs any
  77. // custom request initialization.
  78. func (c *DirectConnect) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  79. req := c.NewRequest(op, params, data)
  80. // Run custom request initialization if present
  81. if initRequest != nil {
  82. initRequest(req)
  83. }
  84. return req
  85. }