service.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package elbv2
  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. // ELBV2 provides the API operation methods for making requests to
  12. // Elastic Load Balancing. See this package's package overview docs
  13. // for details on the service.
  14. //
  15. // ELBV2 methods are safe to use concurrently. It is not safe to
  16. // modify mutate any of the struct's properties though.
  17. type ELBV2 struct {
  18. *client.Client
  19. }
  20. // Used for custom client initialization logic
  21. var initClient func(*client.Client)
  22. // Used for custom request initialization logic
  23. var initRequest func(*request.Request)
  24. // Service information constants
  25. const (
  26. ServiceName = "elasticloadbalancing" // Name of service.
  27. EndpointsID = ServiceName // ID to lookup a service endpoint with.
  28. ServiceID = "Elastic Load Balancing v2" // ServiceID is a unique identifier of a specific service.
  29. )
  30. // New creates a new instance of the ELBV2 client with a session.
  31. // If additional configuration is needed for the client instance use the optional
  32. // aws.Config parameter to add your extra config.
  33. //
  34. // Example:
  35. // mySession := session.Must(session.NewSession())
  36. //
  37. // // Create a ELBV2 client from just a session.
  38. // svc := elbv2.New(mySession)
  39. //
  40. // // Create a ELBV2 client with additional configuration
  41. // svc := elbv2.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  42. func New(p client.ConfigProvider, cfgs ...*aws.Config) *ELBV2 {
  43. c := p.ClientConfig(EndpointsID, cfgs...)
  44. return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName)
  45. }
  46. // newClient creates, initializes and returns a new service client instance.
  47. func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *ELBV2 {
  48. svc := &ELBV2{
  49. Client: client.New(
  50. cfg,
  51. metadata.ClientInfo{
  52. ServiceName: ServiceName,
  53. ServiceID: ServiceID,
  54. SigningName: signingName,
  55. SigningRegion: signingRegion,
  56. PartitionID: partitionID,
  57. Endpoint: endpoint,
  58. APIVersion: "2015-12-01",
  59. },
  60. handlers,
  61. ),
  62. }
  63. // Handlers
  64. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  65. svc.Handlers.Build.PushBackNamed(query.BuildHandler)
  66. svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
  67. svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
  68. svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
  69. // Run custom client initialization if present
  70. if initClient != nil {
  71. initClient(svc.Client)
  72. }
  73. return svc
  74. }
  75. // newRequest creates a new request for a ELBV2 operation and runs any
  76. // custom request initialization.
  77. func (c *ELBV2) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  78. req := c.NewRequest(op, params, data)
  79. // Run custom request initialization if present
  80. if initRequest != nil {
  81. initRequest(req)
  82. }
  83. return req
  84. }