forked from aws/aws-sdk-go-v2
/
api.go
2645 lines (2182 loc) · 80.6 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 cloudwatchevents
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
"github.com/aws/aws-sdk-go-v2/private/protocol/jsonrpc"
)
const opDeleteRule = "DeleteRule"
// DeleteRuleRequest is a API request type for the DeleteRule API operation.
type DeleteRuleRequest struct {
*aws.Request
Input *DeleteRuleInput
Copy func(*DeleteRuleInput) DeleteRuleRequest
}
// Send marshals and sends the DeleteRule API request.
func (r DeleteRuleRequest) Send() (*DeleteRuleOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*DeleteRuleOutput), nil
}
// DeleteRuleRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Deletes the specified rule.
//
// You must remove all targets from a rule using RemoveTargets before you can
// delete the rule.
//
// When you delete a rule, incoming events might continue to match to the deleted
// rule. Please allow a short period of time for changes to take effect.
//
// // Example sending a request using the DeleteRuleRequest method.
// req := client.DeleteRuleRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DeleteRule
func (c *CloudWatchEvents) DeleteRuleRequest(input *DeleteRuleInput) DeleteRuleRequest {
op := &aws.Operation{
Name: opDeleteRule,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &DeleteRuleInput{}
}
output := &DeleteRuleOutput{}
req := c.newRequest(op, input, output)
req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler)
req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
output.responseMetadata = aws.Response{Request: req}
return DeleteRuleRequest{Request: req, Input: input, Copy: c.DeleteRuleRequest}
}
const opDescribeEventBus = "DescribeEventBus"
// DescribeEventBusRequest is a API request type for the DescribeEventBus API operation.
type DescribeEventBusRequest struct {
*aws.Request
Input *DescribeEventBusInput
Copy func(*DescribeEventBusInput) DescribeEventBusRequest
}
// Send marshals and sends the DescribeEventBus API request.
func (r DescribeEventBusRequest) Send() (*DescribeEventBusOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*DescribeEventBusOutput), nil
}
// DescribeEventBusRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Displays the external AWS accounts that are permitted to write events to
// your account using your account's event bus, and the associated policy. To
// enable your account to receive events from other accounts, use PutPermission.
//
// // Example sending a request using the DescribeEventBusRequest method.
// req := client.DescribeEventBusRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeEventBus
func (c *CloudWatchEvents) DescribeEventBusRequest(input *DescribeEventBusInput) DescribeEventBusRequest {
op := &aws.Operation{
Name: opDescribeEventBus,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &DescribeEventBusInput{}
}
output := &DescribeEventBusOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return DescribeEventBusRequest{Request: req, Input: input, Copy: c.DescribeEventBusRequest}
}
const opDescribeRule = "DescribeRule"
// DescribeRuleRequest is a API request type for the DescribeRule API operation.
type DescribeRuleRequest struct {
*aws.Request
Input *DescribeRuleInput
Copy func(*DescribeRuleInput) DescribeRuleRequest
}
// Send marshals and sends the DescribeRule API request.
func (r DescribeRuleRequest) Send() (*DescribeRuleOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*DescribeRuleOutput), nil
}
// DescribeRuleRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Describes the specified rule.
//
// // Example sending a request using the DescribeRuleRequest method.
// req := client.DescribeRuleRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DescribeRule
func (c *CloudWatchEvents) DescribeRuleRequest(input *DescribeRuleInput) DescribeRuleRequest {
op := &aws.Operation{
Name: opDescribeRule,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &DescribeRuleInput{}
}
output := &DescribeRuleOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return DescribeRuleRequest{Request: req, Input: input, Copy: c.DescribeRuleRequest}
}
const opDisableRule = "DisableRule"
// DisableRuleRequest is a API request type for the DisableRule API operation.
type DisableRuleRequest struct {
*aws.Request
Input *DisableRuleInput
Copy func(*DisableRuleInput) DisableRuleRequest
}
// Send marshals and sends the DisableRule API request.
func (r DisableRuleRequest) Send() (*DisableRuleOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*DisableRuleOutput), nil
}
// DisableRuleRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Disables the specified rule. A disabled rule won't match any events, and
// won't self-trigger if it has a schedule expression.
//
// When you disable a rule, incoming events might continue to match to the disabled
// rule. Please allow a short period of time for changes to take effect.
//
// // Example sending a request using the DisableRuleRequest method.
// req := client.DisableRuleRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DisableRule
func (c *CloudWatchEvents) DisableRuleRequest(input *DisableRuleInput) DisableRuleRequest {
op := &aws.Operation{
Name: opDisableRule,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &DisableRuleInput{}
}
output := &DisableRuleOutput{}
req := c.newRequest(op, input, output)
req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler)
req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
output.responseMetadata = aws.Response{Request: req}
return DisableRuleRequest{Request: req, Input: input, Copy: c.DisableRuleRequest}
}
const opEnableRule = "EnableRule"
// EnableRuleRequest is a API request type for the EnableRule API operation.
type EnableRuleRequest struct {
*aws.Request
Input *EnableRuleInput
Copy func(*EnableRuleInput) EnableRuleRequest
}
// Send marshals and sends the EnableRule API request.
func (r EnableRuleRequest) Send() (*EnableRuleOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*EnableRuleOutput), nil
}
// EnableRuleRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Enables the specified rule. If the rule does not exist, the operation fails.
//
// When you enable a rule, incoming events might not immediately start matching
// to a newly enabled rule. Please allow a short period of time for changes
// to take effect.
//
// // Example sending a request using the EnableRuleRequest method.
// req := client.EnableRuleRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/EnableRule
func (c *CloudWatchEvents) EnableRuleRequest(input *EnableRuleInput) EnableRuleRequest {
op := &aws.Operation{
Name: opEnableRule,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &EnableRuleInput{}
}
output := &EnableRuleOutput{}
req := c.newRequest(op, input, output)
req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler)
req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
output.responseMetadata = aws.Response{Request: req}
return EnableRuleRequest{Request: req, Input: input, Copy: c.EnableRuleRequest}
}
const opListRuleNamesByTarget = "ListRuleNamesByTarget"
// ListRuleNamesByTargetRequest is a API request type for the ListRuleNamesByTarget API operation.
type ListRuleNamesByTargetRequest struct {
*aws.Request
Input *ListRuleNamesByTargetInput
Copy func(*ListRuleNamesByTargetInput) ListRuleNamesByTargetRequest
}
// Send marshals and sends the ListRuleNamesByTarget API request.
func (r ListRuleNamesByTargetRequest) Send() (*ListRuleNamesByTargetOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*ListRuleNamesByTargetOutput), nil
}
// ListRuleNamesByTargetRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Lists the rules for the specified target. You can see which of the rules
// in Amazon CloudWatch Events can invoke a specific target in your account.
//
// // Example sending a request using the ListRuleNamesByTargetRequest method.
// req := client.ListRuleNamesByTargetRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRuleNamesByTarget
func (c *CloudWatchEvents) ListRuleNamesByTargetRequest(input *ListRuleNamesByTargetInput) ListRuleNamesByTargetRequest {
op := &aws.Operation{
Name: opListRuleNamesByTarget,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &ListRuleNamesByTargetInput{}
}
output := &ListRuleNamesByTargetOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return ListRuleNamesByTargetRequest{Request: req, Input: input, Copy: c.ListRuleNamesByTargetRequest}
}
const opListRules = "ListRules"
// ListRulesRequest is a API request type for the ListRules API operation.
type ListRulesRequest struct {
*aws.Request
Input *ListRulesInput
Copy func(*ListRulesInput) ListRulesRequest
}
// Send marshals and sends the ListRules API request.
func (r ListRulesRequest) Send() (*ListRulesOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*ListRulesOutput), nil
}
// ListRulesRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Lists your Amazon CloudWatch Events rules. You can either list all the rules
// or you can provide a prefix to match to the rule names.
//
// // Example sending a request using the ListRulesRequest method.
// req := client.ListRulesRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListRules
func (c *CloudWatchEvents) ListRulesRequest(input *ListRulesInput) ListRulesRequest {
op := &aws.Operation{
Name: opListRules,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &ListRulesInput{}
}
output := &ListRulesOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return ListRulesRequest{Request: req, Input: input, Copy: c.ListRulesRequest}
}
const opListTargetsByRule = "ListTargetsByRule"
// ListTargetsByRuleRequest is a API request type for the ListTargetsByRule API operation.
type ListTargetsByRuleRequest struct {
*aws.Request
Input *ListTargetsByRuleInput
Copy func(*ListTargetsByRuleInput) ListTargetsByRuleRequest
}
// Send marshals and sends the ListTargetsByRule API request.
func (r ListTargetsByRuleRequest) Send() (*ListTargetsByRuleOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*ListTargetsByRuleOutput), nil
}
// ListTargetsByRuleRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Lists the targets assigned to the specified rule.
//
// // Example sending a request using the ListTargetsByRuleRequest method.
// req := client.ListTargetsByRuleRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/ListTargetsByRule
func (c *CloudWatchEvents) ListTargetsByRuleRequest(input *ListTargetsByRuleInput) ListTargetsByRuleRequest {
op := &aws.Operation{
Name: opListTargetsByRule,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &ListTargetsByRuleInput{}
}
output := &ListTargetsByRuleOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return ListTargetsByRuleRequest{Request: req, Input: input, Copy: c.ListTargetsByRuleRequest}
}
const opPutEvents = "PutEvents"
// PutEventsRequest is a API request type for the PutEvents API operation.
type PutEventsRequest struct {
*aws.Request
Input *PutEventsInput
Copy func(*PutEventsInput) PutEventsRequest
}
// Send marshals and sends the PutEvents API request.
func (r PutEventsRequest) Send() (*PutEventsOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*PutEventsOutput), nil
}
// PutEventsRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Sends custom events to Amazon CloudWatch Events so that they can be matched
// to rules.
//
// // Example sending a request using the PutEventsRequest method.
// req := client.PutEventsRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutEvents
func (c *CloudWatchEvents) PutEventsRequest(input *PutEventsInput) PutEventsRequest {
op := &aws.Operation{
Name: opPutEvents,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &PutEventsInput{}
}
output := &PutEventsOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return PutEventsRequest{Request: req, Input: input, Copy: c.PutEventsRequest}
}
const opPutPermission = "PutPermission"
// PutPermissionRequest is a API request type for the PutPermission API operation.
type PutPermissionRequest struct {
*aws.Request
Input *PutPermissionInput
Copy func(*PutPermissionInput) PutPermissionRequest
}
// Send marshals and sends the PutPermission API request.
func (r PutPermissionRequest) Send() (*PutPermissionOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*PutPermissionOutput), nil
}
// PutPermissionRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Running PutPermission permits the specified AWS account to put events to
// your account's default event bus. CloudWatch Events rules in your account
// are triggered by these events arriving to your default event bus.
//
// For another account to send events to your account, that external account
// must have a CloudWatch Events rule with your account's default event bus
// as a target.
//
// To enable multiple AWS accounts to put events to your default event bus,
// run PutPermission once for each of these accounts.
//
// The permission policy on the default event bus cannot exceed 10KB in size.
//
// // Example sending a request using the PutPermissionRequest method.
// req := client.PutPermissionRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutPermission
func (c *CloudWatchEvents) PutPermissionRequest(input *PutPermissionInput) PutPermissionRequest {
op := &aws.Operation{
Name: opPutPermission,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &PutPermissionInput{}
}
output := &PutPermissionOutput{}
req := c.newRequest(op, input, output)
req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler)
req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
output.responseMetadata = aws.Response{Request: req}
return PutPermissionRequest{Request: req, Input: input, Copy: c.PutPermissionRequest}
}
const opPutRule = "PutRule"
// PutRuleRequest is a API request type for the PutRule API operation.
type PutRuleRequest struct {
*aws.Request
Input *PutRuleInput
Copy func(*PutRuleInput) PutRuleRequest
}
// Send marshals and sends the PutRule API request.
func (r PutRuleRequest) Send() (*PutRuleOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*PutRuleOutput), nil
}
// PutRuleRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Creates or updates the specified rule. Rules are enabled by default, or based
// on value of the state. You can disable a rule using DisableRule.
//
// If you are updating an existing rule, the rule is completely replaced with
// what you specify in this PutRule command. If you omit arguments in PutRule,
// the old values for those arguments are not kept. Instead, they are replaced
// with null values.
//
// When you create or update a rule, incoming events might not immediately start
// matching to new or updated rules. Please allow a short period of time for
// changes to take effect.
//
// A rule must contain at least an EventPattern or ScheduleExpression. Rules
// with EventPatterns are triggered when a matching event is observed. Rules
// with ScheduleExpressions self-trigger based on the given schedule. A rule
// can have both an EventPattern and a ScheduleExpression, in which case the
// rule triggers on matching events as well as on a schedule.
//
// Most services in AWS treat : or / as the same character in Amazon Resource
// Names (ARNs). However, CloudWatch Events uses an exact match in event patterns
// and rules. Be sure to use the correct ARN characters when creating event
// patterns so that they match the ARN syntax in the event you want to match.
//
// // Example sending a request using the PutRuleRequest method.
// req := client.PutRuleRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutRule
func (c *CloudWatchEvents) PutRuleRequest(input *PutRuleInput) PutRuleRequest {
op := &aws.Operation{
Name: opPutRule,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &PutRuleInput{}
}
output := &PutRuleOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return PutRuleRequest{Request: req, Input: input, Copy: c.PutRuleRequest}
}
const opPutTargets = "PutTargets"
// PutTargetsRequest is a API request type for the PutTargets API operation.
type PutTargetsRequest struct {
*aws.Request
Input *PutTargetsInput
Copy func(*PutTargetsInput) PutTargetsRequest
}
// Send marshals and sends the PutTargets API request.
func (r PutTargetsRequest) Send() (*PutTargetsOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*PutTargetsOutput), nil
}
// PutTargetsRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Adds the specified targets to the specified rule, or updates the targets
// if they are already associated with the rule.
//
// Targets are the resources that are invoked when a rule is triggered.
//
// You can configure the following as targets for CloudWatch Events:
//
// * EC2 instances
//
// * AWS Lambda functions
//
// * Streams in Amazon Kinesis Streams
//
// * Delivery streams in Amazon Kinesis Firehose
//
// * Amazon ECS tasks
//
// * AWS Step Functions state machines
//
// * AWS Batch jobs
//
// * Pipelines in Amazon Code Pipeline
//
// * Amazon Inspector assessment templates
//
// * Amazon SNS topics
//
// * Amazon SQS queues, including FIFO queues
//
// * The default event bus of another AWS account
//
// Note that creating rules with built-in targets is supported only in the AWS
// Management Console.
//
// For some target types, PutTargets provides target-specific parameters. If
// the target is an Amazon Kinesis stream, you can optionally specify which
// shard the event goes to by using the KinesisParameters argument. To invoke
// a command on multiple EC2 instances with one rule, you can use the RunCommandParameters
// field.
//
// To be able to make API calls against the resources that you own, Amazon CloudWatch
// Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources,
// CloudWatch Events relies on resource-based policies. For EC2 instances, Amazon
// Kinesis streams, and AWS Step Functions state machines, CloudWatch Events
// relies on IAM roles that you specify in the RoleARN argument in PutTargets.
// For more information, see Authentication and Access Control (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/auth-and-access-control-cwe.html)
// in the Amazon CloudWatch Events User Guide.
//
// If another AWS account is in the same region and has granted you permission
// (using PutPermission), you can send events to that account by setting that
// account's event bus as a target of the rules in your account. To send the
// matched events to the other account, specify that account's event bus as
// the Arn when you run PutTargets. If your account sends events to another
// account, your account is charged for each sent event. Each event sent to
// antoher account is charged as a custom event. The account receiving the event
// is not charged. For more information on pricing, see Amazon CloudWatch Pricing
// (https://aws.amazon.com/cloudwatch/pricing/).
//
// For more information about enabling cross-account events, see PutPermission.
//
// Input, InputPath and InputTransformer are mutually exclusive and optional
// parameters of a target. When a rule is triggered due to a matched event:
//
// * If none of the following arguments are specified for a target, then
// the entire event is passed to the target in JSON form (unless the target
// is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from
// the event is passed to the target).
//
// * If Input is specified in the form of valid JSON, then the matched event
// is overridden with this constant.
//
// * If InputPath is specified in the form of JSONPath (for example, $.detail),
// then only the part of the event specified in the path is passed to the
// target (for example, only the detail part of the event is passed).
//
// * If InputTransformer is specified, then one or more specified JSONPaths
// are extracted from the event and used as values in a template that you
// specify as the input to the target.
//
// When you specify InputPath or InputTransformer, you must use JSON dot notation,
// not bracket notation.
//
// When you add targets to a rule and the associated rule triggers soon after,
// new or updated targets might not be immediately invoked. Please allow a short
// period of time for changes to take effect.
//
// This action can partially fail if too many requests are made at the same
// time. If that happens, FailedEntryCount is non-zero in the response and each
// entry in FailedEntries provides the ID of the failed target and the error
// code.
//
// // Example sending a request using the PutTargetsRequest method.
// req := client.PutTargetsRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/PutTargets
func (c *CloudWatchEvents) PutTargetsRequest(input *PutTargetsInput) PutTargetsRequest {
op := &aws.Operation{
Name: opPutTargets,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &PutTargetsInput{}
}
output := &PutTargetsOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return PutTargetsRequest{Request: req, Input: input, Copy: c.PutTargetsRequest}
}
const opRemovePermission = "RemovePermission"
// RemovePermissionRequest is a API request type for the RemovePermission API operation.
type RemovePermissionRequest struct {
*aws.Request
Input *RemovePermissionInput
Copy func(*RemovePermissionInput) RemovePermissionRequest
}
// Send marshals and sends the RemovePermission API request.
func (r RemovePermissionRequest) Send() (*RemovePermissionOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*RemovePermissionOutput), nil
}
// RemovePermissionRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Revokes the permission of another AWS account to be able to put events to
// your default event bus. Specify the account to revoke by the StatementId
// value that you associated with the account when you granted it permission
// with PutPermission. You can find the StatementId by using DescribeEventBus.
//
// // Example sending a request using the RemovePermissionRequest method.
// req := client.RemovePermissionRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemovePermission
func (c *CloudWatchEvents) RemovePermissionRequest(input *RemovePermissionInput) RemovePermissionRequest {
op := &aws.Operation{
Name: opRemovePermission,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &RemovePermissionInput{}
}
output := &RemovePermissionOutput{}
req := c.newRequest(op, input, output)
req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler)
req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
output.responseMetadata = aws.Response{Request: req}
return RemovePermissionRequest{Request: req, Input: input, Copy: c.RemovePermissionRequest}
}
const opRemoveTargets = "RemoveTargets"
// RemoveTargetsRequest is a API request type for the RemoveTargets API operation.
type RemoveTargetsRequest struct {
*aws.Request
Input *RemoveTargetsInput
Copy func(*RemoveTargetsInput) RemoveTargetsRequest
}
// Send marshals and sends the RemoveTargets API request.
func (r RemoveTargetsRequest) Send() (*RemoveTargetsOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*RemoveTargetsOutput), nil
}
// RemoveTargetsRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Removes the specified targets from the specified rule. When the rule is triggered,
// those targets are no longer be invoked.
//
// When you remove a target, when the associated rule triggers, removed targets
// might continue to be invoked. Please allow a short period of time for changes
// to take effect.
//
// This action can partially fail if too many requests are made at the same
// time. If that happens, FailedEntryCount is non-zero in the response and each
// entry in FailedEntries provides the ID of the failed target and the error
// code.
//
// // Example sending a request using the RemoveTargetsRequest method.
// req := client.RemoveTargetsRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/RemoveTargets
func (c *CloudWatchEvents) RemoveTargetsRequest(input *RemoveTargetsInput) RemoveTargetsRequest {
op := &aws.Operation{
Name: opRemoveTargets,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &RemoveTargetsInput{}
}
output := &RemoveTargetsOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return RemoveTargetsRequest{Request: req, Input: input, Copy: c.RemoveTargetsRequest}
}
const opTestEventPattern = "TestEventPattern"
// TestEventPatternRequest is a API request type for the TestEventPattern API operation.
type TestEventPatternRequest struct {
*aws.Request
Input *TestEventPatternInput
Copy func(*TestEventPatternInput) TestEventPatternRequest
}
// Send marshals and sends the TestEventPattern API request.
func (r TestEventPatternRequest) Send() (*TestEventPatternOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*TestEventPatternOutput), nil
}
// TestEventPatternRequest returns a request value for making API operation for
// Amazon CloudWatch Events.
//
// Tests whether the specified event pattern matches the provided event.
//
// Most services in AWS treat : or / as the same character in Amazon Resource
// Names (ARNs). However, CloudWatch Events uses an exact match in event patterns
// and rules. Be sure to use the correct ARN characters when creating event
// patterns so that they match the ARN syntax in the event you want to match.
//
// // Example sending a request using the TestEventPatternRequest method.
// req := client.TestEventPatternRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/TestEventPattern
func (c *CloudWatchEvents) TestEventPatternRequest(input *TestEventPatternInput) TestEventPatternRequest {
op := &aws.Operation{
Name: opTestEventPattern,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &TestEventPatternInput{}
}
output := &TestEventPatternOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return TestEventPatternRequest{Request: req, Input: input, Copy: c.TestEventPatternRequest}
}
// The array properties for the submitted job, such as the size of the array.
// The array size can be between 2 and 10,000. If you specify array properties
// for a job, it becomes an array job. This parameter is used only if the target
// is an AWS Batch job.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/BatchArrayProperties
type BatchArrayProperties struct {
_ struct{} `type:"structure"`
// The size of the array, if this is an array batch job. Valid values are integers
// between 2 and 10,000.
Size *int64 `type:"integer"`
}
// String returns the string representation
func (s BatchArrayProperties) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s BatchArrayProperties) GoString() string {
return s.String()
}
// The custom parameters to be used when the target is an AWS Batch job.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/BatchParameters
type BatchParameters struct {
_ struct{} `type:"structure"`
// The array properties for the submitted job, such as the size of the array.
// The array size can be between 2 and 10,000. If you specify array properties
// for a job, it becomes an array job. This parameter is used only if the target
// is an AWS Batch job.
ArrayProperties *BatchArrayProperties `type:"structure"`
// The ARN or name of the job definition to use if the event target is an AWS
// Batch job. This job definition must already exist.
//
// JobDefinition is a required field
JobDefinition *string `type:"string" required:"true"`
// The name to use for this execution of the job, if the target is an AWS Batch
// job.
//
// JobName is a required field
JobName *string `type:"string" required:"true"`
// The retry strategy to use for failed jobs, if the target is an AWS Batch
// job. The retry strategy is the number of times to retry the failed job execution.
// Valid values are 1 to 10. When you specify a retry strategy here, it overrides
// the retry strategy defined in the job definition.
RetryStrategy *BatchRetryStrategy `type:"structure"`
}
// String returns the string representation
func (s BatchParameters) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s BatchParameters) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *BatchParameters) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "BatchParameters"}
if s.JobDefinition == nil {