service.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package applicationautoscaling
  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. // Application Auto Scaling is a general purpose Auto Scaling service for supported
  12. // elastic AWS resources. With Application Auto Scaling, you can automatically
  13. // scale your AWS resources, with an experience similar to that of Auto Scaling.
  14. //
  15. // At this time, Application Auto Scaling only supports scaling Amazon ECS
  16. // services.
  17. //
  18. // For example, you can use Application Auto Scaling to accomplish the following
  19. // tasks:
  20. //
  21. // Define scaling policies for automatically adjusting your application’s
  22. // resources
  23. //
  24. // Scale your resources in response to CloudWatch alarms
  25. //
  26. // View history of your scaling events
  27. //
  28. // Application Auto Scaling is available in the following regions:
  29. //
  30. // us-east-1
  31. //
  32. // us-west-1
  33. //
  34. // us-west-2
  35. //
  36. // ap-southeast-1
  37. //
  38. // ap-southeast-2
  39. //
  40. // ap-northeast-1
  41. //
  42. // eu-central-1
  43. //
  44. // eu-west-1
  45. //The service client's operations are safe to be used concurrently.
  46. // It is not safe to mutate any of the client's properties though.
  47. type ApplicationAutoScaling struct {
  48. *client.Client
  49. }
  50. // Used for custom client initialization logic
  51. var initClient func(*client.Client)
  52. // Used for custom request initialization logic
  53. var initRequest func(*request.Request)
  54. // A ServiceName is the name of the service the client will make API calls to.
  55. const ServiceName = "autoscaling"
  56. // New creates a new instance of the ApplicationAutoScaling client with a session.
  57. // If additional configuration is needed for the client instance use the optional
  58. // aws.Config parameter to add your extra config.
  59. //
  60. // Example:
  61. // // Create a ApplicationAutoScaling client from just a session.
  62. // svc := applicationautoscaling.New(mySession)
  63. //
  64. // // Create a ApplicationAutoScaling client with additional configuration
  65. // svc := applicationautoscaling.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  66. func New(p client.ConfigProvider, cfgs ...*aws.Config) *ApplicationAutoScaling {
  67. c := p.ClientConfig(ServiceName, cfgs...)
  68. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  69. }
  70. // newClient creates, initializes and returns a new service client instance.
  71. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *ApplicationAutoScaling {
  72. svc := &ApplicationAutoScaling{
  73. Client: client.New(
  74. cfg,
  75. metadata.ClientInfo{
  76. ServiceName: ServiceName,
  77. SigningName: "application-autoscaling",
  78. SigningRegion: signingRegion,
  79. Endpoint: endpoint,
  80. APIVersion: "2016-02-06",
  81. JSONVersion: "1.1",
  82. TargetPrefix: "AnyScaleFrontendService",
  83. },
  84. handlers,
  85. ),
  86. }
  87. // Handlers
  88. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  89. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  90. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  91. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  92. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  93. // Run custom client initialization if present
  94. if initClient != nil {
  95. initClient(svc.Client)
  96. }
  97. return svc
  98. }
  99. // newRequest creates a new request for a ApplicationAutoScaling operation and runs any
  100. // custom request initialization.
  101. func (c *ApplicationAutoScaling) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  102. req := c.NewRequest(op, params, data)
  103. // Run custom request initialization if present
  104. if initRequest != nil {
  105. initRequest(req)
  106. }
  107. return req
  108. }