service.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package ec2
  3. import (
  4. "github.com/aws/aws-sdk-go/aws"
  5. "github.com/aws/aws-sdk-go/aws/defaults"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. "github.com/aws/aws-sdk-go/aws/service"
  8. "github.com/aws/aws-sdk-go/aws/service/serviceinfo"
  9. "github.com/aws/aws-sdk-go/internal/protocol/ec2query"
  10. "github.com/aws/aws-sdk-go/internal/signer/v4"
  11. )
  12. // Amazon Elastic Compute Cloud (Amazon EC2) provides resizable computing capacity
  13. // in the Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your
  14. // need to invest in hardware up front, so you can develop and deploy applications
  15. // faster.
  16. type EC2 struct {
  17. *service.Service
  18. }
  19. // Used for custom service initialization logic
  20. var initService func(*service.Service)
  21. // Used for custom request initialization logic
  22. var initRequest func(*request.Request)
  23. // New returns a new EC2 client.
  24. func New(config *aws.Config) *EC2 {
  25. service := &service.Service{
  26. ServiceInfo: serviceinfo.ServiceInfo{
  27. Config: defaults.DefaultConfig.Merge(config),
  28. ServiceName: "ec2",
  29. APIVersion: "2015-04-15",
  30. },
  31. }
  32. service.Initialize()
  33. // Handlers
  34. service.Handlers.Sign.PushBack(v4.Sign)
  35. service.Handlers.Build.PushBack(ec2query.Build)
  36. service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
  37. service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
  38. service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
  39. // Run custom service initialization if present
  40. if initService != nil {
  41. initService(service)
  42. }
  43. return &EC2{service}
  44. }
  45. // newRequest creates a new request for a EC2 operation and runs any
  46. // custom request initialization.
  47. func (c *EC2) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  48. req := c.NewRequest(op, params, data)
  49. // Run custom request initialization if present
  50. if initRequest != nil {
  51. initRequest(req)
  52. }
  53. return req
  54. }