service.go 3.3 KB

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