1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
2
3package autoscalingplans
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/jsonrpc"
12)
13
14// AutoScalingPlans provides the API operation methods for making requests to
15// AWS Auto Scaling Plans. See this package's package overview docs
16// for details on the service.
17//
18// AutoScalingPlans methods are safe to use concurrently. It is not safe to
19// modify mutate any of the struct's properties though.
20type AutoScalingPlans 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 = "autoscaling"        // Name of service.
33	EndpointsID = "autoscaling-plans"  // ID to lookup a service endpoint with.
34	ServiceID   = "Auto Scaling Plans" // ServiceID is a unique identifier of a specific service.
35)
36
37// New creates a new instance of the AutoScalingPlans 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 AutoScalingPlans client from just a session.
45//     svc := autoscalingplans.New(mySession)
46//
47//     // Create a AutoScalingPlans client with additional configuration
48//     svc := autoscalingplans.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
49func New(p client.ConfigProvider, cfgs ...*aws.Config) *AutoScalingPlans {
50	c := p.ClientConfig(EndpointsID, cfgs...)
51	if c.SigningNameDerived || len(c.SigningName) == 0 {
52		c.SigningName = "autoscaling-plans"
53	}
54	return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName)
55}
56
57// newClient creates, initializes and returns a new service client instance.
58func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *AutoScalingPlans {
59	svc := &AutoScalingPlans{
60		Client: client.New(
61			cfg,
62			metadata.ClientInfo{
63				ServiceName:   ServiceName,
64				ServiceID:     ServiceID,
65				SigningName:   signingName,
66				SigningRegion: signingRegion,
67				PartitionID:   partitionID,
68				Endpoint:      endpoint,
69				APIVersion:    "2018-01-06",
70				JSONVersion:   "1.1",
71				TargetPrefix:  "AnyScaleScalingPlannerFrontendService",
72			},
73			handlers,
74		),
75	}
76
77	// Handlers
78	svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
79	svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
80	svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
81	svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
82	svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
83
84	// Run custom client initialization if present
85	if initClient != nil {
86		initClient(svc.Client)
87	}
88
89	return svc
90}
91
92// newRequest creates a new request for a AutoScalingPlans operation and runs any
93// custom request initialization.
94func (c *AutoScalingPlans) newRequest(op *request.Operation, params, data interface{}) *request.Request {
95	req := c.NewRequest(op, params, data)
96
97	// Run custom request initialization if present
98	if initRequest != nil {
99		initRequest(req)
100	}
101
102	return req
103}
104