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