forked from aws/aws-sdk-go-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.go
3353 lines (2783 loc) · 104 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 cloudtrail
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
const opAddTags = "AddTags"
// AddTagsRequest is a API request type for the AddTags API operation.
type AddTagsRequest struct {
*aws.Request
Input *AddTagsInput
}
// Send marshals and sends the AddTags API request.
func (r AddTagsRequest) Send() (*AddTagsOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*AddTagsOutput), nil
}
// AddTagsRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Adds one or more tags to a trail, up to a limit of 50. Tags must be unique
// per trail. Overwrites an existing tag's value when a new value is specified
// for an existing tag key. If you specify a key without a value, the tag will
// be created with the specified key and a value of null. You can tag a trail
// that applies to all regions only from the region in which the trail was created
// (that is, from its home region).
//
// // Example sending a request using the AddTagsRequest method.
// req := client.AddTagsRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/AddTags
func (c *CloudTrail) AddTagsRequest(input *AddTagsInput) AddTagsRequest {
op := &aws.Operation{
Name: opAddTags,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &AddTagsInput{}
}
output := &AddTagsOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return AddTagsRequest{Request: req, Input: input}
}
const opCreateTrail = "CreateTrail"
// CreateTrailRequest is a API request type for the CreateTrail API operation.
type CreateTrailRequest struct {
*aws.Request
Input *CreateTrailInput
}
// Send marshals and sends the CreateTrail API request.
func (r CreateTrailRequest) Send() (*CreateTrailOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*CreateTrailOutput), nil
}
// CreateTrailRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Creates a trail that specifies the settings for delivery of log data to an
// Amazon S3 bucket. A maximum of five trails can exist in a region, irrespective
// of the region in which they were created.
//
// // Example sending a request using the CreateTrailRequest method.
// req := client.CreateTrailRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/CreateTrail
func (c *CloudTrail) CreateTrailRequest(input *CreateTrailInput) CreateTrailRequest {
op := &aws.Operation{
Name: opCreateTrail,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &CreateTrailInput{}
}
output := &CreateTrailOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return CreateTrailRequest{Request: req, Input: input}
}
const opDeleteTrail = "DeleteTrail"
// DeleteTrailRequest is a API request type for the DeleteTrail API operation.
type DeleteTrailRequest struct {
*aws.Request
Input *DeleteTrailInput
}
// Send marshals and sends the DeleteTrail API request.
func (r DeleteTrailRequest) Send() (*DeleteTrailOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*DeleteTrailOutput), nil
}
// DeleteTrailRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Deletes a trail. This operation must be called from the region in which the
// trail was created. DeleteTrail cannot be called on the shadow trails (replicated
// trails in other regions) of a trail that is enabled in all regions.
//
// // Example sending a request using the DeleteTrailRequest method.
// req := client.DeleteTrailRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/DeleteTrail
func (c *CloudTrail) DeleteTrailRequest(input *DeleteTrailInput) DeleteTrailRequest {
op := &aws.Operation{
Name: opDeleteTrail,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &DeleteTrailInput{}
}
output := &DeleteTrailOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return DeleteTrailRequest{Request: req, Input: input}
}
const opDescribeTrails = "DescribeTrails"
// DescribeTrailsRequest is a API request type for the DescribeTrails API operation.
type DescribeTrailsRequest struct {
*aws.Request
Input *DescribeTrailsInput
}
// Send marshals and sends the DescribeTrails API request.
func (r DescribeTrailsRequest) Send() (*DescribeTrailsOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*DescribeTrailsOutput), nil
}
// DescribeTrailsRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Retrieves settings for the trail associated with the current region for your
// account.
//
// // Example sending a request using the DescribeTrailsRequest method.
// req := client.DescribeTrailsRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/DescribeTrails
func (c *CloudTrail) DescribeTrailsRequest(input *DescribeTrailsInput) DescribeTrailsRequest {
op := &aws.Operation{
Name: opDescribeTrails,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &DescribeTrailsInput{}
}
output := &DescribeTrailsOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return DescribeTrailsRequest{Request: req, Input: input}
}
const opGetEventSelectors = "GetEventSelectors"
// GetEventSelectorsRequest is a API request type for the GetEventSelectors API operation.
type GetEventSelectorsRequest struct {
*aws.Request
Input *GetEventSelectorsInput
}
// Send marshals and sends the GetEventSelectors API request.
func (r GetEventSelectorsRequest) Send() (*GetEventSelectorsOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*GetEventSelectorsOutput), nil
}
// GetEventSelectorsRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Describes the settings for the event selectors that you configured for your
// trail. The information returned for your event selectors includes the following:
//
// * The S3 objects that you are logging for data events.
//
// * If your event selector includes management events.
//
// * If your event selector includes read-only events, write-only events,
// or all.
//
// For more information, see Logging Data and Management Events for Trails
// (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-and-data-events-with-cloudtrail.html)
// in the AWS CloudTrail User Guide.
//
// // Example sending a request using the GetEventSelectorsRequest method.
// req := client.GetEventSelectorsRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/GetEventSelectors
func (c *CloudTrail) GetEventSelectorsRequest(input *GetEventSelectorsInput) GetEventSelectorsRequest {
op := &aws.Operation{
Name: opGetEventSelectors,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &GetEventSelectorsInput{}
}
output := &GetEventSelectorsOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return GetEventSelectorsRequest{Request: req, Input: input}
}
const opGetTrailStatus = "GetTrailStatus"
// GetTrailStatusRequest is a API request type for the GetTrailStatus API operation.
type GetTrailStatusRequest struct {
*aws.Request
Input *GetTrailStatusInput
}
// Send marshals and sends the GetTrailStatus API request.
func (r GetTrailStatusRequest) Send() (*GetTrailStatusOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*GetTrailStatusOutput), nil
}
// GetTrailStatusRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Returns a JSON-formatted list of information about the specified trail. Fields
// include information on delivery errors, Amazon SNS and Amazon S3 errors,
// and start and stop logging times for each trail. This operation returns trail
// status from a single region. To return trail status from all regions, you
// must call the operation on each region.
//
// // Example sending a request using the GetTrailStatusRequest method.
// req := client.GetTrailStatusRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/GetTrailStatus
func (c *CloudTrail) GetTrailStatusRequest(input *GetTrailStatusInput) GetTrailStatusRequest {
op := &aws.Operation{
Name: opGetTrailStatus,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &GetTrailStatusInput{}
}
output := &GetTrailStatusOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return GetTrailStatusRequest{Request: req, Input: input}
}
const opListPublicKeys = "ListPublicKeys"
// ListPublicKeysRequest is a API request type for the ListPublicKeys API operation.
type ListPublicKeysRequest struct {
*aws.Request
Input *ListPublicKeysInput
}
// Send marshals and sends the ListPublicKeys API request.
func (r ListPublicKeysRequest) Send() (*ListPublicKeysOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*ListPublicKeysOutput), nil
}
// ListPublicKeysRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Returns all public keys whose private keys were used to sign the digest files
// within the specified time range. The public key is needed to validate digest
// files that were signed with its corresponding private key.
//
// CloudTrail uses different private/public key pairs per region. Each digest
// file is signed with a private key unique to its region. Therefore, when you
// validate a digest file from a particular region, you must look in the same
// region for its corresponding public key.
//
// // Example sending a request using the ListPublicKeysRequest method.
// req := client.ListPublicKeysRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/ListPublicKeys
func (c *CloudTrail) ListPublicKeysRequest(input *ListPublicKeysInput) ListPublicKeysRequest {
op := &aws.Operation{
Name: opListPublicKeys,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &ListPublicKeysInput{}
}
output := &ListPublicKeysOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return ListPublicKeysRequest{Request: req, Input: input}
}
const opListTags = "ListTags"
// ListTagsRequest is a API request type for the ListTags API operation.
type ListTagsRequest struct {
*aws.Request
Input *ListTagsInput
}
// Send marshals and sends the ListTags API request.
func (r ListTagsRequest) Send() (*ListTagsOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*ListTagsOutput), nil
}
// ListTagsRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Lists the tags for the trail in the current region.
//
// // Example sending a request using the ListTagsRequest method.
// req := client.ListTagsRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/ListTags
func (c *CloudTrail) ListTagsRequest(input *ListTagsInput) ListTagsRequest {
op := &aws.Operation{
Name: opListTags,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &ListTagsInput{}
}
output := &ListTagsOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return ListTagsRequest{Request: req, Input: input}
}
const opLookupEvents = "LookupEvents"
// LookupEventsRequest is a API request type for the LookupEvents API operation.
type LookupEventsRequest struct {
*aws.Request
Input *LookupEventsInput
}
// Send marshals and sends the LookupEvents API request.
func (r LookupEventsRequest) Send() (*LookupEventsOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*LookupEventsOutput), nil
}
// LookupEventsRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Looks up API activity events captured by CloudTrail that create, update,
// or delete resources in your account. Events for a region can be looked up
// for the times in which you had CloudTrail turned on in that region during
// the last seven days. Lookup supports the following attributes:
//
// * Event ID
//
// * Event name
//
// * Event source
//
// * Resource name
//
// * Resource type
//
// * User name
//
// All attributes are optional. The default number of results returned is 10,
// with a maximum of 50 possible. The response includes a token that you can
// use to get the next page of results.
//
// The rate of lookup requests is limited to one per second per account. If
// this limit is exceeded, a throttling error occurs.
//
// Events that occurred during the selected time range will not be available
// for lookup if CloudTrail logging was not enabled when the events occurred.
//
// // Example sending a request using the LookupEventsRequest method.
// req := client.LookupEventsRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/LookupEvents
func (c *CloudTrail) LookupEventsRequest(input *LookupEventsInput) LookupEventsRequest {
op := &aws.Operation{
Name: opLookupEvents,
HTTPMethod: "POST",
HTTPPath: "/",
Paginator: &aws.Paginator{
InputTokens: []string{"NextToken"},
OutputTokens: []string{"NextToken"},
LimitToken: "MaxResults",
TruncationToken: "",
},
}
if input == nil {
input = &LookupEventsInput{}
}
output := &LookupEventsOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return LookupEventsRequest{Request: req, Input: input}
}
// LookupEventsPages iterates over the pages of a LookupEvents operation,
// calling the "fn" function with the response data for each page. To stop
// iterating, return false from the fn function.
//
// See LookupEvents 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 LookupEvents operation.
// pageNum := 0
// err := client.LookupEventsPages(params,
// func(page *LookupEventsOutput, lastPage bool) bool {
// pageNum++
// fmt.Println(page)
// return pageNum <= 3
// })
//
func (c *CloudTrail) LookupEventsPages(input *LookupEventsInput, fn func(*LookupEventsOutput, bool) bool) error {
return c.LookupEventsPagesWithContext(aws.BackgroundContext(), input, fn)
}
// LookupEventsPagesWithContext same as LookupEventsPages 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 *CloudTrail) LookupEventsPagesWithContext(ctx aws.Context, input *LookupEventsInput, fn func(*LookupEventsOutput, bool) bool, opts ...aws.Option) error {
p := aws.Pagination{
NewRequest: func() (*aws.Request, error) {
var inCpy *LookupEventsInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req := c.LookupEventsRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req.Request, nil
},
}
cont := true
for p.Next() && cont {
cont = fn(p.Page().(*LookupEventsOutput), !p.HasNextPage())
}
return p.Err()
}
const opPutEventSelectors = "PutEventSelectors"
// PutEventSelectorsRequest is a API request type for the PutEventSelectors API operation.
type PutEventSelectorsRequest struct {
*aws.Request
Input *PutEventSelectorsInput
}
// Send marshals and sends the PutEventSelectors API request.
func (r PutEventSelectorsRequest) Send() (*PutEventSelectorsOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*PutEventSelectorsOutput), nil
}
// PutEventSelectorsRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Configures an event selector for your trail. Use event selectors to specify
// whether you want your trail to log management and/or data events. When an
// event occurs in your account, CloudTrail evaluates the event selectors in
// all trails. For each trail, if the event matches any event selector, the
// trail processes and logs the event. If the event doesn't match any event
// selector, the trail doesn't log the event.
//
// Example
//
// You create an event selector for a trail and specify that you want write-only
// events.
//
// The EC2 GetConsoleOutput and RunInstances API operations occur in your account.
//
// CloudTrail evaluates whether the events match your event selectors.
//
// The RunInstances is a write-only event and it matches your event selector.
// The trail logs the event.
//
// The GetConsoleOutput is a read-only event but it doesn't match your event
// selector. The trail doesn't log the event.
//
// The PutEventSelectors operation must be called from the region in which the
// trail was created; otherwise, an InvalidHomeRegionException is thrown.
//
// You can configure up to five event selectors for each trail. For more information,
// see Logging Data and Management Events for Trails (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-and-data-events-with-cloudtrail.html)
// in the AWS CloudTrail User Guide.
//
// // Example sending a request using the PutEventSelectorsRequest method.
// req := client.PutEventSelectorsRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/PutEventSelectors
func (c *CloudTrail) PutEventSelectorsRequest(input *PutEventSelectorsInput) PutEventSelectorsRequest {
op := &aws.Operation{
Name: opPutEventSelectors,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &PutEventSelectorsInput{}
}
output := &PutEventSelectorsOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return PutEventSelectorsRequest{Request: req, Input: input}
}
const opRemoveTags = "RemoveTags"
// RemoveTagsRequest is a API request type for the RemoveTags API operation.
type RemoveTagsRequest struct {
*aws.Request
Input *RemoveTagsInput
}
// Send marshals and sends the RemoveTags API request.
func (r RemoveTagsRequest) Send() (*RemoveTagsOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*RemoveTagsOutput), nil
}
// RemoveTagsRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Removes the specified tags from a trail.
//
// // Example sending a request using the RemoveTagsRequest method.
// req := client.RemoveTagsRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/RemoveTags
func (c *CloudTrail) RemoveTagsRequest(input *RemoveTagsInput) RemoveTagsRequest {
op := &aws.Operation{
Name: opRemoveTags,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &RemoveTagsInput{}
}
output := &RemoveTagsOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return RemoveTagsRequest{Request: req, Input: input}
}
const opStartLogging = "StartLogging"
// StartLoggingRequest is a API request type for the StartLogging API operation.
type StartLoggingRequest struct {
*aws.Request
Input *StartLoggingInput
}
// Send marshals and sends the StartLogging API request.
func (r StartLoggingRequest) Send() (*StartLoggingOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*StartLoggingOutput), nil
}
// StartLoggingRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Starts the recording of AWS API calls and log file delivery for a trail.
// For a trail that is enabled in all regions, this operation must be called
// from the region in which the trail was created. This operation cannot be
// called on the shadow trails (replicated trails in other regions) of a trail
// that is enabled in all regions.
//
// // Example sending a request using the StartLoggingRequest method.
// req := client.StartLoggingRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/StartLogging
func (c *CloudTrail) StartLoggingRequest(input *StartLoggingInput) StartLoggingRequest {
op := &aws.Operation{
Name: opStartLogging,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &StartLoggingInput{}
}
output := &StartLoggingOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return StartLoggingRequest{Request: req, Input: input}
}
const opStopLogging = "StopLogging"
// StopLoggingRequest is a API request type for the StopLogging API operation.
type StopLoggingRequest struct {
*aws.Request
Input *StopLoggingInput
}
// Send marshals and sends the StopLogging API request.
func (r StopLoggingRequest) Send() (*StopLoggingOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*StopLoggingOutput), nil
}
// StopLoggingRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Suspends the recording of AWS API calls and log file delivery for the specified
// trail. Under most circumstances, there is no need to use this action. You
// can update a trail without stopping it first. This action is the only way
// to stop recording. For a trail enabled in all regions, this operation must
// be called from the region in which the trail was created, or an InvalidHomeRegionException
// will occur. This operation cannot be called on the shadow trails (replicated
// trails in other regions) of a trail enabled in all regions.
//
// // Example sending a request using the StopLoggingRequest method.
// req := client.StopLoggingRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/StopLogging
func (c *CloudTrail) StopLoggingRequest(input *StopLoggingInput) StopLoggingRequest {
op := &aws.Operation{
Name: opStopLogging,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &StopLoggingInput{}
}
output := &StopLoggingOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return StopLoggingRequest{Request: req, Input: input}
}
const opUpdateTrail = "UpdateTrail"
// UpdateTrailRequest is a API request type for the UpdateTrail API operation.
type UpdateTrailRequest struct {
*aws.Request
Input *UpdateTrailInput
}
// Send marshals and sends the UpdateTrail API request.
func (r UpdateTrailRequest) Send() (*UpdateTrailOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*UpdateTrailOutput), nil
}
// UpdateTrailRequest returns a request value for making API operation for
// AWS CloudTrail.
//
// Updates the settings that specify delivery of log files. Changes to a trail
// do not require stopping the CloudTrail service. Use this action to designate
// an existing bucket for log delivery. If the existing bucket has previously
// been a target for CloudTrail log files, an IAM policy exists for the bucket.
// UpdateTrail must be called from the region in which the trail was created;
// otherwise, an InvalidHomeRegionException is thrown.
//
// // Example sending a request using the UpdateTrailRequest method.
// req := client.UpdateTrailRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/UpdateTrail
func (c *CloudTrail) UpdateTrailRequest(input *UpdateTrailInput) UpdateTrailRequest {
op := &aws.Operation{
Name: opUpdateTrail,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &UpdateTrailInput{}
}
output := &UpdateTrailOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return UpdateTrailRequest{Request: req, Input: input}
}
// Specifies the tags to add to a trail.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/AddTagsRequest
type AddTagsInput struct {
_ struct{} `type:"structure"`
// Specifies the ARN of the trail to which one or more tags will be added. The
// format of a trail ARN is:
//
// arn:aws:cloudtrail:us-east-1:123456789012:trail/MyTrail
//
// ResourceId is a required field
ResourceId *string `type:"string" required:"true"`
// Contains a list of CloudTrail tags, up to a limit of 50
TagsList []Tag `type:"list"`
}
// String returns the string representation
func (s AddTagsInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s AddTagsInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *AddTagsInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "AddTagsInput"}
if s.ResourceId == nil {
invalidParams.Add(aws.NewErrParamRequired("ResourceId"))
}
if s.TagsList != nil {
for i, v := range s.TagsList {
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TagsList", i), err.(aws.ErrInvalidParams))
}
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetResourceId sets the ResourceId field's value.
func (s *AddTagsInput) SetResourceId(v string) *AddTagsInput {
s.ResourceId = &v
return s
}
// SetTagsList sets the TagsList field's value.
func (s *AddTagsInput) SetTagsList(v []Tag) *AddTagsInput {
s.TagsList = v
return s
}
// Returns the objects or data listed below if successful. Otherwise, returns
// an error.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/AddTagsResponse
type AddTagsOutput struct {
_ struct{} `type:"structure"`
responseMetadata aws.Response
}
// String returns the string representation
func (s AddTagsOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s AddTagsOutput) GoString() string {
return s.String()
}
// SDKResponseMetdata return sthe response metadata for the API.
func (s AddTagsOutput) SDKResponseMetadata() aws.Response {
return s.responseMetadata
}
// Specifies the settings for each trail.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/CreateTrailRequest
type CreateTrailInput struct {
_ struct{} `type:"structure"`
// Specifies a log group name using an Amazon Resource Name (ARN), a unique
// identifier that represents the log group to which CloudTrail logs will be
// delivered. Not required unless you specify CloudWatchLogsRoleArn.
CloudWatchLogsLogGroupArn *string `type:"string"`
// Specifies the role for the CloudWatch Logs endpoint to assume to write to
// a user's log group.
CloudWatchLogsRoleArn *string `type:"string"`
// Specifies whether log file integrity validation is enabled. The default is
// false.
//
// When you disable log file integrity validation, the chain of digest files
// is broken after one hour. CloudTrail will not create digest files for log
// files that were delivered during a period in which log file integrity validation
// was disabled. For example, if you enable log file integrity validation at
// noon on January 1, disable it at noon on January 2, and re-enable it at noon
// on January 10, digest files will not be created for the log files delivered
// from noon on January 2 to noon on January 10. The same applies whenever you
// stop CloudTrail logging or delete a trail.
EnableLogFileValidation *bool `type:"boolean"`
// Specifies whether the trail is publishing events from global services such
// as IAM to the log files.
IncludeGlobalServiceEvents *bool `type:"boolean"`
// Specifies whether the trail is created in the current region or in all regions.
// The default is false.
IsMultiRegionTrail *bool `type:"boolean"`
// Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail.
// The value can be an alias name prefixed by "alias/", a fully specified ARN
// to an alias, a fully specified ARN to a key, or a globally unique identifier.
//
// Examples:
//
// * alias/MyAliasName
//
// * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName
//
// * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012
//
// * 12345678-1234-1234-1234-123456789012
KmsKeyId *string `type:"string"`
// Specifies the name of the trail. The name must meet the following requirements:
//
// * Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores
// (_), or dashes (-)
//
// * Start with a letter or number, and end with a letter or number
//
// * Be between 3 and 128 characters
//
// * Have no adjacent periods, underscores or dashes. Names like my-_namespace
// and my--namespace are invalid.
//