forked from aws/aws-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.go
3201 lines (2823 loc) · 121 KB
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package applicationautoscaling
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/request"
)
const opDeleteScalingPolicy = "DeleteScalingPolicy"
// DeleteScalingPolicyRequest generates a "aws/request.Request" representing the
// client's request for the DeleteScalingPolicy operation. The "output" return
// value will be populated with the request's response once the request complets
// successfuly.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See DeleteScalingPolicy for more information on using the DeleteScalingPolicy
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the DeleteScalingPolicyRequest method.
// req, resp := client.DeleteScalingPolicyRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeleteScalingPolicy
func (c *ApplicationAutoScaling) DeleteScalingPolicyRequest(input *DeleteScalingPolicyInput) (req *request.Request, output *DeleteScalingPolicyOutput) {
op := &request.Operation{
Name: opDeleteScalingPolicy,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &DeleteScalingPolicyInput{}
}
output = &DeleteScalingPolicyOutput{}
req = c.newRequest(op, input, output)
return
}
// DeleteScalingPolicy API operation for Application Auto Scaling.
//
// Deletes the specified Application Auto Scaling scaling policy.
//
// Deleting a policy deletes the underlying alarm action, but does not delete
// the CloudWatch alarm associated with the scaling policy, even if it no longer
// has an associated action.
//
// To create a scaling policy or update an existing one, see PutScalingPolicy.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Application Auto Scaling's
// API operation DeleteScalingPolicy for usage and error information.
//
// Returned Error Codes:
// * ErrCodeValidationException "ValidationException"
// An exception was thrown for a validation issue. Review the available parameters
// for the API request.
//
// * ErrCodeObjectNotFoundException "ObjectNotFoundException"
// The specified object could not be found. For any Put or Register API operation,
// which depends on the existence of a scalable target, this exception is thrown
// if the scalable target with the specified service namespace, resource ID,
// and scalable dimension does not exist. For any Delete or Deregister API operation,
// this exception is thrown if the resource that is to be deleted or deregistered
// cannot be found.
//
// * ErrCodeConcurrentUpdateException "ConcurrentUpdateException"
// Concurrent updates caused an exception, for example, if you request an update
// to an Application Auto Scaling resource that already has a pending update.
//
// * ErrCodeInternalServiceException "InternalServiceException"
// The service encountered an internal error.
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeleteScalingPolicy
func (c *ApplicationAutoScaling) DeleteScalingPolicy(input *DeleteScalingPolicyInput) (*DeleteScalingPolicyOutput, error) {
req, out := c.DeleteScalingPolicyRequest(input)
return out, req.Send()
}
// DeleteScalingPolicyWithContext is the same as DeleteScalingPolicy with the addition of
// the ability to pass a context and additional request options.
//
// See DeleteScalingPolicy for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApplicationAutoScaling) DeleteScalingPolicyWithContext(ctx aws.Context, input *DeleteScalingPolicyInput, opts ...request.Option) (*DeleteScalingPolicyOutput, error) {
req, out := c.DeleteScalingPolicyRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
const opDeregisterScalableTarget = "DeregisterScalableTarget"
// DeregisterScalableTargetRequest generates a "aws/request.Request" representing the
// client's request for the DeregisterScalableTarget operation. The "output" return
// value will be populated with the request's response once the request complets
// successfuly.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See DeregisterScalableTarget for more information on using the DeregisterScalableTarget
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the DeregisterScalableTargetRequest method.
// req, resp := client.DeregisterScalableTargetRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeregisterScalableTarget
func (c *ApplicationAutoScaling) DeregisterScalableTargetRequest(input *DeregisterScalableTargetInput) (req *request.Request, output *DeregisterScalableTargetOutput) {
op := &request.Operation{
Name: opDeregisterScalableTarget,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &DeregisterScalableTargetInput{}
}
output = &DeregisterScalableTargetOutput{}
req = c.newRequest(op, input, output)
return
}
// DeregisterScalableTarget API operation for Application Auto Scaling.
//
// Deregisters a scalable target.
//
// Deregistering a scalable target deletes the scaling policies that are associated
// with it.
//
// To create a scalable target or update an existing one, see RegisterScalableTarget.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Application Auto Scaling's
// API operation DeregisterScalableTarget for usage and error information.
//
// Returned Error Codes:
// * ErrCodeValidationException "ValidationException"
// An exception was thrown for a validation issue. Review the available parameters
// for the API request.
//
// * ErrCodeObjectNotFoundException "ObjectNotFoundException"
// The specified object could not be found. For any Put or Register API operation,
// which depends on the existence of a scalable target, this exception is thrown
// if the scalable target with the specified service namespace, resource ID,
// and scalable dimension does not exist. For any Delete or Deregister API operation,
// this exception is thrown if the resource that is to be deleted or deregistered
// cannot be found.
//
// * ErrCodeConcurrentUpdateException "ConcurrentUpdateException"
// Concurrent updates caused an exception, for example, if you request an update
// to an Application Auto Scaling resource that already has a pending update.
//
// * ErrCodeInternalServiceException "InternalServiceException"
// The service encountered an internal error.
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeregisterScalableTarget
func (c *ApplicationAutoScaling) DeregisterScalableTarget(input *DeregisterScalableTargetInput) (*DeregisterScalableTargetOutput, error) {
req, out := c.DeregisterScalableTargetRequest(input)
return out, req.Send()
}
// DeregisterScalableTargetWithContext is the same as DeregisterScalableTarget with the addition of
// the ability to pass a context and additional request options.
//
// See DeregisterScalableTarget for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApplicationAutoScaling) DeregisterScalableTargetWithContext(ctx aws.Context, input *DeregisterScalableTargetInput, opts ...request.Option) (*DeregisterScalableTargetOutput, error) {
req, out := c.DeregisterScalableTargetRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
const opDescribeScalableTargets = "DescribeScalableTargets"
// DescribeScalableTargetsRequest generates a "aws/request.Request" representing the
// client's request for the DescribeScalableTargets operation. The "output" return
// value will be populated with the request's response once the request complets
// successfuly.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See DescribeScalableTargets for more information on using the DescribeScalableTargets
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the DescribeScalableTargetsRequest method.
// req, resp := client.DescribeScalableTargetsRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalableTargets
func (c *ApplicationAutoScaling) DescribeScalableTargetsRequest(input *DescribeScalableTargetsInput) (req *request.Request, output *DescribeScalableTargetsOutput) {
op := &request.Operation{
Name: opDescribeScalableTargets,
HTTPMethod: "POST",
HTTPPath: "/",
Paginator: &request.Paginator{
InputTokens: []string{"NextToken"},
OutputTokens: []string{"NextToken"},
LimitToken: "MaxResults",
TruncationToken: "",
},
}
if input == nil {
input = &DescribeScalableTargetsInput{}
}
output = &DescribeScalableTargetsOutput{}
req = c.newRequest(op, input, output)
return
}
// DescribeScalableTargets API operation for Application Auto Scaling.
//
// Provides descriptive information about the scalable targets in the specified
// namespace.
//
// You can filter the results using the ResourceIds and ScalableDimension parameters.
//
// To create a scalable target or update an existing one, see RegisterScalableTarget.
// If you are no longer using a scalable target, you can deregister it using
// DeregisterScalableTarget.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Application Auto Scaling's
// API operation DescribeScalableTargets for usage and error information.
//
// Returned Error Codes:
// * ErrCodeValidationException "ValidationException"
// An exception was thrown for a validation issue. Review the available parameters
// for the API request.
//
// * ErrCodeInvalidNextTokenException "InvalidNextTokenException"
// The next token supplied was invalid.
//
// * ErrCodeConcurrentUpdateException "ConcurrentUpdateException"
// Concurrent updates caused an exception, for example, if you request an update
// to an Application Auto Scaling resource that already has a pending update.
//
// * ErrCodeInternalServiceException "InternalServiceException"
// The service encountered an internal error.
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalableTargets
func (c *ApplicationAutoScaling) DescribeScalableTargets(input *DescribeScalableTargetsInput) (*DescribeScalableTargetsOutput, error) {
req, out := c.DescribeScalableTargetsRequest(input)
return out, req.Send()
}
// DescribeScalableTargetsWithContext is the same as DescribeScalableTargets with the addition of
// the ability to pass a context and additional request options.
//
// See DescribeScalableTargets for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApplicationAutoScaling) DescribeScalableTargetsWithContext(ctx aws.Context, input *DescribeScalableTargetsInput, opts ...request.Option) (*DescribeScalableTargetsOutput, error) {
req, out := c.DescribeScalableTargetsRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
// DescribeScalableTargetsPages iterates over the pages of a DescribeScalableTargets operation,
// calling the "fn" function with the response data for each page. To stop
// iterating, return false from the fn function.
//
// See DescribeScalableTargets method for more information on how to use this operation.
//
// Note: This operation can generate multiple requests to a service.
//
// // Example iterating over at most 3 pages of a DescribeScalableTargets operation.
// pageNum := 0
// err := client.DescribeScalableTargetsPages(params,
// func(page *DescribeScalableTargetsOutput, lastPage bool) bool {
// pageNum++
// fmt.Println(page)
// return pageNum <= 3
// })
//
func (c *ApplicationAutoScaling) DescribeScalableTargetsPages(input *DescribeScalableTargetsInput, fn func(*DescribeScalableTargetsOutput, bool) bool) error {
return c.DescribeScalableTargetsPagesWithContext(aws.BackgroundContext(), input, fn)
}
// DescribeScalableTargetsPagesWithContext same as DescribeScalableTargetsPages except
// it takes a Context and allows setting request options on the pages.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApplicationAutoScaling) DescribeScalableTargetsPagesWithContext(ctx aws.Context, input *DescribeScalableTargetsInput, fn func(*DescribeScalableTargetsOutput, bool) bool, opts ...request.Option) error {
p := request.Pagination{
NewRequest: func() (*request.Request, error) {
var inCpy *DescribeScalableTargetsInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeScalableTargetsRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
cont := true
for p.Next() && cont {
cont = fn(p.Page().(*DescribeScalableTargetsOutput), !p.HasNextPage())
}
return p.Err()
}
const opDescribeScalingActivities = "DescribeScalingActivities"
// DescribeScalingActivitiesRequest generates a "aws/request.Request" representing the
// client's request for the DescribeScalingActivities operation. The "output" return
// value will be populated with the request's response once the request complets
// successfuly.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See DescribeScalingActivities for more information on using the DescribeScalingActivities
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the DescribeScalingActivitiesRequest method.
// req, resp := client.DescribeScalingActivitiesRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalingActivities
func (c *ApplicationAutoScaling) DescribeScalingActivitiesRequest(input *DescribeScalingActivitiesInput) (req *request.Request, output *DescribeScalingActivitiesOutput) {
op := &request.Operation{
Name: opDescribeScalingActivities,
HTTPMethod: "POST",
HTTPPath: "/",
Paginator: &request.Paginator{
InputTokens: []string{"NextToken"},
OutputTokens: []string{"NextToken"},
LimitToken: "MaxResults",
TruncationToken: "",
},
}
if input == nil {
input = &DescribeScalingActivitiesInput{}
}
output = &DescribeScalingActivitiesOutput{}
req = c.newRequest(op, input, output)
return
}
// DescribeScalingActivities API operation for Application Auto Scaling.
//
// Provides descriptive information about the scaling activities in the specified
// namespace from the previous six weeks.
//
// You can filter the results using the ResourceId and ScalableDimension parameters.
//
// Scaling activities are triggered by CloudWatch alarms that are associated
// with scaling policies. To view the scaling policies for a service namespace,
// see DescribeScalingPolicies. To create a scaling policy or update an existing
// one, see PutScalingPolicy.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Application Auto Scaling's
// API operation DescribeScalingActivities for usage and error information.
//
// Returned Error Codes:
// * ErrCodeValidationException "ValidationException"
// An exception was thrown for a validation issue. Review the available parameters
// for the API request.
//
// * ErrCodeInvalidNextTokenException "InvalidNextTokenException"
// The next token supplied was invalid.
//
// * ErrCodeConcurrentUpdateException "ConcurrentUpdateException"
// Concurrent updates caused an exception, for example, if you request an update
// to an Application Auto Scaling resource that already has a pending update.
//
// * ErrCodeInternalServiceException "InternalServiceException"
// The service encountered an internal error.
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalingActivities
func (c *ApplicationAutoScaling) DescribeScalingActivities(input *DescribeScalingActivitiesInput) (*DescribeScalingActivitiesOutput, error) {
req, out := c.DescribeScalingActivitiesRequest(input)
return out, req.Send()
}
// DescribeScalingActivitiesWithContext is the same as DescribeScalingActivities with the addition of
// the ability to pass a context and additional request options.
//
// See DescribeScalingActivities for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApplicationAutoScaling) DescribeScalingActivitiesWithContext(ctx aws.Context, input *DescribeScalingActivitiesInput, opts ...request.Option) (*DescribeScalingActivitiesOutput, error) {
req, out := c.DescribeScalingActivitiesRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
// DescribeScalingActivitiesPages iterates over the pages of a DescribeScalingActivities operation,
// calling the "fn" function with the response data for each page. To stop
// iterating, return false from the fn function.
//
// See DescribeScalingActivities method for more information on how to use this operation.
//
// Note: This operation can generate multiple requests to a service.
//
// // Example iterating over at most 3 pages of a DescribeScalingActivities operation.
// pageNum := 0
// err := client.DescribeScalingActivitiesPages(params,
// func(page *DescribeScalingActivitiesOutput, lastPage bool) bool {
// pageNum++
// fmt.Println(page)
// return pageNum <= 3
// })
//
func (c *ApplicationAutoScaling) DescribeScalingActivitiesPages(input *DescribeScalingActivitiesInput, fn func(*DescribeScalingActivitiesOutput, bool) bool) error {
return c.DescribeScalingActivitiesPagesWithContext(aws.BackgroundContext(), input, fn)
}
// DescribeScalingActivitiesPagesWithContext same as DescribeScalingActivitiesPages except
// it takes a Context and allows setting request options on the pages.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApplicationAutoScaling) DescribeScalingActivitiesPagesWithContext(ctx aws.Context, input *DescribeScalingActivitiesInput, fn func(*DescribeScalingActivitiesOutput, bool) bool, opts ...request.Option) error {
p := request.Pagination{
NewRequest: func() (*request.Request, error) {
var inCpy *DescribeScalingActivitiesInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeScalingActivitiesRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
cont := true
for p.Next() && cont {
cont = fn(p.Page().(*DescribeScalingActivitiesOutput), !p.HasNextPage())
}
return p.Err()
}
const opDescribeScalingPolicies = "DescribeScalingPolicies"
// DescribeScalingPoliciesRequest generates a "aws/request.Request" representing the
// client's request for the DescribeScalingPolicies operation. The "output" return
// value will be populated with the request's response once the request complets
// successfuly.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See DescribeScalingPolicies for more information on using the DescribeScalingPolicies
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the DescribeScalingPoliciesRequest method.
// req, resp := client.DescribeScalingPoliciesRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalingPolicies
func (c *ApplicationAutoScaling) DescribeScalingPoliciesRequest(input *DescribeScalingPoliciesInput) (req *request.Request, output *DescribeScalingPoliciesOutput) {
op := &request.Operation{
Name: opDescribeScalingPolicies,
HTTPMethod: "POST",
HTTPPath: "/",
Paginator: &request.Paginator{
InputTokens: []string{"NextToken"},
OutputTokens: []string{"NextToken"},
LimitToken: "MaxResults",
TruncationToken: "",
},
}
if input == nil {
input = &DescribeScalingPoliciesInput{}
}
output = &DescribeScalingPoliciesOutput{}
req = c.newRequest(op, input, output)
return
}
// DescribeScalingPolicies API operation for Application Auto Scaling.
//
// Provides descriptive information about the scaling policies in the specified
// namespace.
//
// You can filter the results using the ResourceId, ScalableDimension, and PolicyNames
// parameters.
//
// To create a scaling policy or update an existing one, see PutScalingPolicy.
// If you are no longer using a scaling policy, you can delete it using DeleteScalingPolicy.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Application Auto Scaling's
// API operation DescribeScalingPolicies for usage and error information.
//
// Returned Error Codes:
// * ErrCodeValidationException "ValidationException"
// An exception was thrown for a validation issue. Review the available parameters
// for the API request.
//
// * ErrCodeFailedResourceAccessException "FailedResourceAccessException"
// Failed access to resources caused an exception. This exception is thrown
// when Application Auto Scaling is unable to retrieve the alarms associated
// with a scaling policy due to a client error, for example, if the role ARN
// specified for a scalable target does not have permission to call the CloudWatch
// DescribeAlarms (http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html)
// API operation on behalf of your account.
//
// * ErrCodeInvalidNextTokenException "InvalidNextTokenException"
// The next token supplied was invalid.
//
// * ErrCodeConcurrentUpdateException "ConcurrentUpdateException"
// Concurrent updates caused an exception, for example, if you request an update
// to an Application Auto Scaling resource that already has a pending update.
//
// * ErrCodeInternalServiceException "InternalServiceException"
// The service encountered an internal error.
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalingPolicies
func (c *ApplicationAutoScaling) DescribeScalingPolicies(input *DescribeScalingPoliciesInput) (*DescribeScalingPoliciesOutput, error) {
req, out := c.DescribeScalingPoliciesRequest(input)
return out, req.Send()
}
// DescribeScalingPoliciesWithContext is the same as DescribeScalingPolicies with the addition of
// the ability to pass a context and additional request options.
//
// See DescribeScalingPolicies for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApplicationAutoScaling) DescribeScalingPoliciesWithContext(ctx aws.Context, input *DescribeScalingPoliciesInput, opts ...request.Option) (*DescribeScalingPoliciesOutput, error) {
req, out := c.DescribeScalingPoliciesRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
// DescribeScalingPoliciesPages iterates over the pages of a DescribeScalingPolicies operation,
// calling the "fn" function with the response data for each page. To stop
// iterating, return false from the fn function.
//
// See DescribeScalingPolicies method for more information on how to use this operation.
//
// Note: This operation can generate multiple requests to a service.
//
// // Example iterating over at most 3 pages of a DescribeScalingPolicies operation.
// pageNum := 0
// err := client.DescribeScalingPoliciesPages(params,
// func(page *DescribeScalingPoliciesOutput, lastPage bool) bool {
// pageNum++
// fmt.Println(page)
// return pageNum <= 3
// })
//
func (c *ApplicationAutoScaling) DescribeScalingPoliciesPages(input *DescribeScalingPoliciesInput, fn func(*DescribeScalingPoliciesOutput, bool) bool) error {
return c.DescribeScalingPoliciesPagesWithContext(aws.BackgroundContext(), input, fn)
}
// DescribeScalingPoliciesPagesWithContext same as DescribeScalingPoliciesPages except
// it takes a Context and allows setting request options on the pages.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApplicationAutoScaling) DescribeScalingPoliciesPagesWithContext(ctx aws.Context, input *DescribeScalingPoliciesInput, fn func(*DescribeScalingPoliciesOutput, bool) bool, opts ...request.Option) error {
p := request.Pagination{
NewRequest: func() (*request.Request, error) {
var inCpy *DescribeScalingPoliciesInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeScalingPoliciesRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
cont := true
for p.Next() && cont {
cont = fn(p.Page().(*DescribeScalingPoliciesOutput), !p.HasNextPage())
}
return p.Err()
}
const opPutScalingPolicy = "PutScalingPolicy"
// PutScalingPolicyRequest generates a "aws/request.Request" representing the
// client's request for the PutScalingPolicy operation. The "output" return
// value will be populated with the request's response once the request complets
// successfuly.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See PutScalingPolicy for more information on using the PutScalingPolicy
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the PutScalingPolicyRequest method.
// req, resp := client.PutScalingPolicyRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/PutScalingPolicy
func (c *ApplicationAutoScaling) PutScalingPolicyRequest(input *PutScalingPolicyInput) (req *request.Request, output *PutScalingPolicyOutput) {
op := &request.Operation{
Name: opPutScalingPolicy,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &PutScalingPolicyInput{}
}
output = &PutScalingPolicyOutput{}
req = c.newRequest(op, input, output)
return
}
// PutScalingPolicy API operation for Application Auto Scaling.
//
// Creates or updates a policy for an Application Auto Scaling scalable target.
//
// Each scalable target is identified by a service namespace, resource ID, and
// scalable dimension. A scaling policy applies to the scalable target identified
// by those three attributes. You cannot create a scaling policy without first
// registering a scalable target using RegisterScalableTarget.
//
// To update a policy, specify its policy name and the parameters that you want
// to change. Any parameters that you don't specify are not changed by this
// update request.
//
// You can view the scaling policies for a service namespace using DescribeScalingPolicies.
// If you are no longer using a scaling policy, you can delete it using DeleteScalingPolicy.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Application Auto Scaling's
// API operation PutScalingPolicy for usage and error information.
//
// Returned Error Codes:
// * ErrCodeValidationException "ValidationException"
// An exception was thrown for a validation issue. Review the available parameters
// for the API request.
//
// * ErrCodeLimitExceededException "LimitExceededException"
// Your account exceeded a limit. This exception is thrown when a per-account
// resource limit is exceeded. For more information, see Application Auto Scaling
// Limits (http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_as-app).
//
// * ErrCodeObjectNotFoundException "ObjectNotFoundException"
// The specified object could not be found. For any Put or Register API operation,
// which depends on the existence of a scalable target, this exception is thrown
// if the scalable target with the specified service namespace, resource ID,
// and scalable dimension does not exist. For any Delete or Deregister API operation,
// this exception is thrown if the resource that is to be deleted or deregistered
// cannot be found.
//
// * ErrCodeConcurrentUpdateException "ConcurrentUpdateException"
// Concurrent updates caused an exception, for example, if you request an update
// to an Application Auto Scaling resource that already has a pending update.
//
// * ErrCodeFailedResourceAccessException "FailedResourceAccessException"
// Failed access to resources caused an exception. This exception is thrown
// when Application Auto Scaling is unable to retrieve the alarms associated
// with a scaling policy due to a client error, for example, if the role ARN
// specified for a scalable target does not have permission to call the CloudWatch
// DescribeAlarms (http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html)
// API operation on behalf of your account.
//
// * ErrCodeInternalServiceException "InternalServiceException"
// The service encountered an internal error.
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/PutScalingPolicy
func (c *ApplicationAutoScaling) PutScalingPolicy(input *PutScalingPolicyInput) (*PutScalingPolicyOutput, error) {
req, out := c.PutScalingPolicyRequest(input)
return out, req.Send()
}
// PutScalingPolicyWithContext is the same as PutScalingPolicy with the addition of
// the ability to pass a context and additional request options.
//
// See PutScalingPolicy for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApplicationAutoScaling) PutScalingPolicyWithContext(ctx aws.Context, input *PutScalingPolicyInput, opts ...request.Option) (*PutScalingPolicyOutput, error) {
req, out := c.PutScalingPolicyRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
const opRegisterScalableTarget = "RegisterScalableTarget"
// RegisterScalableTargetRequest generates a "aws/request.Request" representing the
// client's request for the RegisterScalableTarget operation. The "output" return
// value will be populated with the request's response once the request complets
// successfuly.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See RegisterScalableTarget for more information on using the RegisterScalableTarget
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the RegisterScalableTargetRequest method.
// req, resp := client.RegisterScalableTargetRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/RegisterScalableTarget
func (c *ApplicationAutoScaling) RegisterScalableTargetRequest(input *RegisterScalableTargetInput) (req *request.Request, output *RegisterScalableTargetOutput) {
op := &request.Operation{
Name: opRegisterScalableTarget,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &RegisterScalableTargetInput{}
}
output = &RegisterScalableTargetOutput{}
req = c.newRequest(op, input, output)
return
}
// RegisterScalableTarget API operation for Application Auto Scaling.
//
// Registers or updates a scalable target. A scalable target is a resource that
// Application Auto Scaling can scale out or scale in. After you have registered
// a scalable target, you can use this operation to update the minimum and maximum
// values for your scalable dimension.
//
// After you register a scalable target, you can create and apply scaling policies
// using PutScalingPolicy. You can view the scaling policies for a service namespace
// using DescribeScalableTargets. If you are no longer using a scalable target,
// you can deregister it using DeregisterScalableTarget.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Application Auto Scaling's
// API operation RegisterScalableTarget for usage and error information.
//
// Returned Error Codes:
// * ErrCodeValidationException "ValidationException"
// An exception was thrown for a validation issue. Review the available parameters
// for the API request.
//
// * ErrCodeLimitExceededException "LimitExceededException"
// Your account exceeded a limit. This exception is thrown when a per-account
// resource limit is exceeded. For more information, see Application Auto Scaling
// Limits (http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_as-app).
//
// * ErrCodeConcurrentUpdateException "ConcurrentUpdateException"
// Concurrent updates caused an exception, for example, if you request an update
// to an Application Auto Scaling resource that already has a pending update.
//
// * ErrCodeInternalServiceException "InternalServiceException"
// The service encountered an internal error.
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/RegisterScalableTarget
func (c *ApplicationAutoScaling) RegisterScalableTarget(input *RegisterScalableTargetInput) (*RegisterScalableTargetOutput, error) {
req, out := c.RegisterScalableTargetRequest(input)
return out, req.Send()
}
// RegisterScalableTargetWithContext is the same as RegisterScalableTarget with the addition of
// the ability to pass a context and additional request options.
//
// See RegisterScalableTarget for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApplicationAutoScaling) RegisterScalableTargetWithContext(ctx aws.Context, input *RegisterScalableTargetInput, opts ...request.Option) (*RegisterScalableTargetOutput, error) {
req, out := c.RegisterScalableTargetRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
// Represents a CloudWatch alarm associated with a scaling policy.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/Alarm
type Alarm struct {
_ struct{} `type:"structure"`
// The Amazon Resource Name (ARN) of the alarm.
//
// AlarmARN is a required field
AlarmARN *string `type:"string" required:"true"`
// The name of the alarm.
//
// AlarmName is a required field
AlarmName *string `type:"string" required:"true"`
}
// String returns the string representation
func (s Alarm) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s Alarm) GoString() string {
return s.String()
}
// SetAlarmARN sets the AlarmARN field's value.
func (s *Alarm) SetAlarmARN(v string) *Alarm {
s.AlarmARN = &v
return s
}
// SetAlarmName sets the AlarmName field's value.
func (s *Alarm) SetAlarmName(v string) *Alarm {
s.AlarmName = &v
return s
}
// Configures a customized metric for a target tracking policy.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/CustomizedMetricSpecification
type CustomizedMetricSpecification struct {
_ struct{} `type:"structure"`
// The dimensions of the metric.
Dimensions []*MetricDimension `type:"list"`
// The name of the metric.
//
// MetricName is a required field
MetricName *string `type:"string" required:"true"`
// The namespace of the metric.
//
// Namespace is a required field
Namespace *string `type:"string" required:"true"`
// The statistic of the metric.
//
// Statistic is a required field
Statistic *string `type:"string" required:"true" enum:"MetricStatistic"`
// The unit of the metric.
Unit *string `type:"string"`
}
// String returns the string representation
func (s CustomizedMetricSpecification) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s CustomizedMetricSpecification) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *CustomizedMetricSpecification) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "CustomizedMetricSpecification"}
if s.MetricName == nil {
invalidParams.Add(request.NewErrParamRequired("MetricName"))
}
if s.Namespace == nil {
invalidParams.Add(request.NewErrParamRequired("Namespace"))
}
if s.Statistic == nil {
invalidParams.Add(request.NewErrParamRequired("Statistic"))
}
if s.Dimensions != nil {
for i, v := range s.Dimensions {
if v == nil {
continue
}
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
}
}
}