/
generate.go
1749 lines (1380 loc) · 55.7 KB
/
generate.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
package raws
import (
"context"
"io"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/aws/aws-sdk-go/service/cloudfront"
"github.com/aws/aws-sdk-go/service/configservice"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/elasticache"
"github.com/aws/aws-sdk-go/service/elb"
"github.com/aws/aws-sdk-go/service/elbv2"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/rds"
"github.com/aws/aws-sdk-go/service/route53"
"github.com/aws/aws-sdk-go/service/route53resolver"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"github.com/aws/aws-sdk-go/service/ses"
)
// Code generated by github.com/cycloidio/raws/cmd; DO NOT EDIT
// AWSReader is the interface defining all methods that need to be implemented
//
// The next behavior commented in the below paragraph, applies to every method
// which clearly match what's explained, for the sake of not repeating the same,
// over and over.
// The most of the methods defined by this interface, return their results in a
// map. Those maps, have as keys, the AWS region which have been requested and
// the values are the items returned by AWS for such region.
// Because the methods may make calls to different regions, in case that there
// is an error on a region, the returned map won't have any entry for such
// region and such errors will be reported by the returned error, nonetheless
// the items, got from the successful requests to other regions, will be
// returned, with the meaning that the methods will return partial results, in
// case of errors.
// For avoiding by the callers the problem of if the returned map may be nil,
// the function will always return a map instance, which will be of length 0
// in case that there is not any successful request.
type AWSReader interface {
// GetAccountID returns the current ID for the account used
GetAccountID() string
// GetRegions returns the currently used regions for the Connector
GetRegions() []string
// GetInstances returns all EC2 instances based on the input given.
// Returned values are commented in the interface doc comment block.
GetInstances(ctx context.Context, input *ec2.DescribeInstancesInput) (map[string]ec2.DescribeInstancesOutput, error)
// GetVpcs returns all EC2 VPCs based on the input given.
// Returned values are commented in the interface doc comment block.
GetVpcs(ctx context.Context, input *ec2.DescribeVpcsInput) (map[string]ec2.DescribeVpcsOutput, error)
// GetImages returns all EC2 AMI based on the input given.
// Returned values are commented in the interface doc comment block.
GetImages(ctx context.Context, input *ec2.DescribeImagesInput) (map[string]ec2.DescribeImagesOutput, error)
// GetOwnImages returns all EC2 AMI belonging to the Account ID based on the input given.
// Returned values are commented in the interface doc comment block.
GetOwnImages(ctx context.Context, input *ec2.DescribeImagesInput) (map[string]ec2.DescribeImagesOutput, error)
// GetSecurityGroups returns all EC2 security groups based on the input given.
// Returned values are commented in the interface doc comment block.
GetSecurityGroups(ctx context.Context, input *ec2.DescribeSecurityGroupsInput) (map[string]ec2.DescribeSecurityGroupsOutput, error)
// GetSubnets returns all EC2 subnets based on the input given.
// Returned values are commented in the interface doc comment block.
GetSubnets(ctx context.Context, input *ec2.DescribeSubnetsInput) (map[string]ec2.DescribeSubnetsOutput, error)
// GetVolumes returns all EC2 volumes based on the input given.
// Returned values are commented in the interface doc comment block.
GetVolumes(ctx context.Context, input *ec2.DescribeVolumesInput) (map[string]ec2.DescribeVolumesOutput, error)
// GetSnapshots returns all snapshots based on the input given.
// Returned values are commented in the interface doc comment block.
GetSnapshots(ctx context.Context, input *ec2.DescribeSnapshotsInput) (map[string]ec2.DescribeSnapshotsOutput, error)
// GetOwnSnapshots returns all snapshots belonging to the Account ID based on the input given.
// Returned values are commented in the interface doc comment block.
GetOwnSnapshots(ctx context.Context, input *ec2.DescribeSnapshotsInput) (map[string]ec2.DescribeSnapshotsOutput, error)
// GetLaunchTemplates returns all LaunchTemplate belonging to the Account ID based on the input given.
// Returned values are commented in the interface doc comment block.
GetLaunchTemplates(ctx context.Context, input *ec2.DescribeLaunchTemplatesInput) (map[string]ec2.DescribeLaunchTemplatesOutput, error)
// GetAutoScalingGroups returns all AutoScalingGroup belonging to the Account ID based on the input given.
// Returned values are commented in the interface doc comment block.
GetAutoScalingGroups(ctx context.Context, input *autoscaling.DescribeAutoScalingGroupsInput) (map[string]autoscaling.DescribeAutoScalingGroupsOutput, error)
// GetLaunchConfigurations returns all LaunchConfiguration belonging to the Account ID based on the input given.
// Returned values are commented in the interface doc comment block.
GetLaunchConfigurations(ctx context.Context, input *autoscaling.DescribeLaunchConfigurationsInput) (map[string]autoscaling.DescribeLaunchConfigurationsOutput, error)
// GetElastiCacheClusters returns all Elasticache clusters based on the input given.
// Returned values are commented in the interface doc comment block.
GetElastiCacheClusters(ctx context.Context, input *elasticache.DescribeCacheClustersInput) (map[string]elasticache.DescribeCacheClustersOutput, error)
// GetElastiCacheTags returns a list of tags of Elasticache resources based on its ARN.
// Returned values are commented in the interface doc comment block.
GetElastiCacheTags(ctx context.Context, input *elasticache.ListTagsForResourceInput) (map[string]elasticache.TagListMessage, error)
// GetLoadBalancers returns a list of ELB (v1) based on the input from the different regions.
// Returned values are commented in the interface doc comment block.
GetLoadBalancers(ctx context.Context, input *elb.DescribeLoadBalancersInput) (map[string]elb.DescribeLoadBalancersOutput, error)
// GetLoadBalancersTags returns a list of Tags based on the input from the different regions.
// Returned values are commented in the interface doc comment block.
GetLoadBalancersTags(ctx context.Context, input *elb.DescribeTagsInput) (map[string]elb.DescribeTagsOutput, error)
// GetLoadBalancersV2 returns a list of ELB (v2) - also known as ALB - based on the input from the different regions.
// Returned values are commented in the interface doc comment block.
GetLoadBalancersV2(ctx context.Context, input *elbv2.DescribeLoadBalancersInput) (map[string]elbv2.DescribeLoadBalancersOutput, error)
// GetLoadBalancersV2Tags returns a list of Tags based on the input from the different regions.
// Returned values are commented in the interface doc comment block.
GetLoadBalancersV2Tags(ctx context.Context, input *elbv2.DescribeTagsInput) (map[string]elbv2.DescribeTagsOutput, error)
// GetDBInstances returns all DB instances based on the input given.
// Returned values are commented in the interface doc comment block.
GetDBInstances(ctx context.Context, input *rds.DescribeDBInstancesInput) (map[string]rds.DescribeDBInstancesOutput, error)
// GetDBInstancesTags returns a list of tags from an ARN, extra filters for tags can also be provided.
// Returned values are commented in the interface doc comment block.
GetDBInstancesTags(ctx context.Context, input *rds.ListTagsForResourceInput) (map[string]rds.ListTagsForResourceOutput, error)
// ListBuckets returns all S3 buckets based on the input given and specifically
// filtering by Location as ListBuckets does not do it by itself
// Returned values are commented in the interface doc comment block.
ListBuckets(ctx context.Context, input *s3.ListBucketsInput) (map[string]s3.ListBucketsOutput, error)
// GetBucketTags returns tags associated with S3 buckets based on the input given.
// Returned values are commented in the interface doc comment block.
GetBucketTags(ctx context.Context, input *s3.GetBucketTaggingInput) (map[string]s3.GetBucketTaggingOutput, error)
// ListObjects returns a list of all S3 objects in a bucket based on the input given.
// Returned values are commented in the interface doc comment block.
ListObjects(ctx context.Context, input *s3.ListObjectsInput) (map[string]s3.ListObjectsOutput, error)
// GetObjectsTags returns tags associated with S3 objects based on the input given.
// Returned values are commented in the interface doc comment block.
GetObjectsTags(ctx context.Context, input *s3.GetObjectTaggingInput) (map[string]s3.GetObjectTaggingOutput, error)
// GetRecordedResourceCounts returns counts of the AWS resources which have
// been recorded by AWS Config.
// See https://docs.aws.amazon.com/config/latest/APIReference/API_GetDiscoveredResourceCounts.html
// for more information about what to enable in your AWS account, the list of
// supported resources, etc.
GetRecordedResourceCounts(ctx context.Context, input *configservice.GetDiscoveredResourceCountsInput) (map[string]configservice.GetDiscoveredResourceCountsOutput, error)
// DownloadObject downloads an object in a bucket based on the input given
DownloadObject(ctx context.Context, w io.WriterAt, input *s3.GetObjectInput, options ...func(*s3manager.Downloader)) (int64, error)
// GetCloudFrontDistributions returns all the CloudFront Distributions on the given input
// Returned values are commented in the interface doc comment block.
GetCloudFrontDistributions(ctx context.Context, input *cloudfront.ListDistributionsInput) (map[string]cloudfront.ListDistributionsOutput, error)
// GetCloudFrontPublicKeys returns all the CloudFront Public Keys on the given input
// Returned values are commented in the interface doc comment block.
GetCloudFrontPublicKeys(ctx context.Context, input *cloudfront.ListPublicKeysInput) (map[string]cloudfront.ListPublicKeysOutput, error)
// GetCloudFrontOriginAccessIdentities returns all the CloudFront Origin Access Identities on the given input
// Returned values are commented in the interface doc comment block.
GetCloudFrontOriginAccessIdentities(ctx context.Context, input *cloudfront.ListCloudFrontOriginAccessIdentitiesInput) (map[string]cloudfront.ListCloudFrontOriginAccessIdentitiesOutput, error)
// GetAccessKeys returns all the IAM AccessKeys on the given input
// Returned values are commented in the interface doc comment block.
GetAccessKeys(ctx context.Context, input *iam.ListAccessKeysInput) (map[string]iam.ListAccessKeysOutput, error)
// GetAccountAliases returns all the IAM AccountAliases on the given input
// Returned values are commented in the interface doc comment block.
GetAccountAliases(ctx context.Context, input *iam.ListAccountAliasesInput) (map[string]iam.ListAccountAliasesOutput, error)
// GetAccountPasswordPolicy returns the IAM AccountPasswordPolicy on the given input
// Returned values are commented in the interface doc comment block.
GetAccountPasswordPolicy(ctx context.Context, input *iam.GetAccountPasswordPolicyInput) (map[string]iam.GetAccountPasswordPolicyOutput, error)
// GetGroups returns the IAM Groups on the given input
// Returned values are commented in the interface doc comment block.
GetGroups(ctx context.Context, input *iam.ListGroupsInput) (map[string]iam.ListGroupsOutput, error)
// GetGroupPolicies returns the IAM GroupPolicies on the given input
// Returned values are commented in the interface doc comment block.
GetGroupPolicies(ctx context.Context, input *iam.ListGroupPoliciesInput) (map[string]iam.ListGroupPoliciesOutput, error)
// GetAttachedGroupPolicies returns the IAM AttachedGroupPolicies on the given input
// Returned values are commented in the interface doc comment block.
GetAttachedGroupPolicies(ctx context.Context, input *iam.ListAttachedGroupPoliciesInput) (map[string]iam.ListAttachedGroupPoliciesOutput, error)
// GetIstanceProfiles returns the IAM InstanceProfiles on the given input
// Returned values are commented in the interface doc comment block.
GetInstanceProfiles(ctx context.Context, input *iam.ListInstanceProfilesInput) (map[string]iam.ListInstanceProfilesOutput, error)
// GetOpenIDConnectProviders returns the IAM OpenIDConnectProviders on the given input
// Returned values are commented in the interface doc comment block.
GetOpenIDConnectProviders(ctx context.Context, input *iam.ListOpenIDConnectProvidersInput) (map[string]iam.ListOpenIDConnectProvidersOutput, error)
// GetPolicies returns the IAM Policies on the given input
// Returned values are commented in the interface doc comment block.
GetPolicies(ctx context.Context, input *iam.ListPoliciesInput) (map[string]iam.ListPoliciesOutput, error)
// GetRoles returns the IAM Roles on the given input
// Returned values are commented in the interface doc comment block.
GetRoles(ctx context.Context, input *iam.ListRolesInput) (map[string]iam.ListRolesOutput, error)
// GetRolePolicies returns the IAM RolePolicies on the given input
// Returned values are commented in the interface doc comment block.
GetRolePolicies(ctx context.Context, input *iam.ListRolePoliciesInput) (map[string]iam.ListRolePoliciesOutput, error)
// GetAttachedRolePolicies returns the IAM AttachedRolePolicies on the given input
// Returned values are commented in the interface doc comment block.
GetAttachedRolePolicies(ctx context.Context, input *iam.ListAttachedRolePoliciesInput) (map[string]iam.ListAttachedRolePoliciesOutput, error)
// GetSAMLProviders returns the IAM SAMLProviders on the given input
// Returned values are commented in the interface doc comment block.
GetSAMLProviders(ctx context.Context, input *iam.ListSAMLProvidersInput) (map[string]iam.ListSAMLProvidersOutput, error)
// GetServerCertificates returns the IAM ServerCertificates on the given input
// Returned values are commented in the interface doc comment block.
GetServerCertificates(ctx context.Context, input *iam.ListServerCertificatesInput) (map[string]iam.ListServerCertificatesOutput, error)
// GetUsers returns the IAM Users on the given input
// Returned values are commented in the interface doc comment block.
GetUsers(ctx context.Context, input *iam.ListUsersInput) (map[string]iam.ListUsersOutput, error)
// GetUserPolicies returns the IAM UserPolicies on the given input
// Returned values are commented in the interface doc comment block.
GetUserPolicies(ctx context.Context, input *iam.ListUserPoliciesInput) (map[string]iam.ListUserPoliciesOutput, error)
// GetAttachedUserPolicies returns the IAM AttachedUserPolicies on the given input
// Returned values are commented in the interface doc comment block.
GetAttachedUserPolicies(ctx context.Context, input *iam.ListAttachedUserPoliciesInput) (map[string]iam.ListAttachedUserPoliciesOutput, error)
// GetSSHPublicKey returns the IAM SSHPublicKey on the given input
// Returned values are commented in the interface doc comment block.
GetSSHPublicKey(ctx context.Context, input *iam.GetSSHPublicKeyInput) (map[string]iam.GetSSHPublicKeyOutput, error)
// GetActiveReceiptRuleSet returns the SES ActiveReceiptRuleSet on the given input
// Returned values are commented in the interface doc comment block.
GetActiveReceiptRuleSet(ctx context.Context, input *ses.DescribeActiveReceiptRuleSetInput) (map[string]ses.DescribeActiveReceiptRuleSetOutput, error)
// GetIdentities returns the SES Identities on the given input
// Returned values are commented in the interface doc comment block.
GetIdentities(ctx context.Context, input *ses.ListIdentitiesInput) (map[string]ses.ListIdentitiesOutput, error)
// GetReceiptFilters returns the SES ReceiptFilters on the given input
// Returned values are commented in the interface doc comment block.
GetReceiptFilters(ctx context.Context, input *ses.ListReceiptFiltersInput) (map[string]ses.ListReceiptFiltersOutput, error)
// GetConfigurationSets returns the SES ConfigurationSets on the given input
// Returned values are commented in the interface doc comment block.
GetConfigurationSets(ctx context.Context, input *ses.ListConfigurationSetsInput) (map[string]ses.ListConfigurationSetsOutput, error)
// GetIdentityNotificationAttributes returns the SES IdentityNotificationAttributes on the given input
// Returned values are commented in the interface doc comment block.
GetIdentityNotificationAttributes(ctx context.Context, input *ses.GetIdentityNotificationAttributesInput) (map[string]ses.GetIdentityNotificationAttributesOutput, error)
// GetTemplates returns the SES Templates on the given input
// Returned values are commented in the interface doc comment block.
GetTemplates(ctx context.Context, input *ses.ListTemplatesInput) (map[string]ses.ListTemplatesOutput, error)
// GetReusableDelegationSets returns the Route53 ReusableDelegationSets on the given input
// Returned values are commented in the interface doc comment block.
GetReusableDelegationSets(ctx context.Context, input *route53.ListReusableDelegationSetsInput) (map[string]route53.ListReusableDelegationSetsOutput, error)
// GetHealthChecks returns the Route53 HealthChecks on the given input
// Returned values are commented in the interface doc comment block.
GetHealthChecks(ctx context.Context, input *route53.ListHealthChecksInput) (map[string]route53.ListHealthChecksOutput, error)
// GetQueryLoggingConfigs returns the Route53 QueryLoggingConfigs on the given input
// Returned values are commented in the interface doc comment block.
GetQueryLoggingConfigs(ctx context.Context, input *route53.ListQueryLoggingConfigsInput) (map[string]route53.ListQueryLoggingConfigsOutput, error)
// GetResourceRecordSets returns the Route53 ResourceRecordSets on the given input
// Returned values are commented in the interface doc comment block.
GetResourceRecordSets(ctx context.Context, input *route53.ListResourceRecordSetsInput) (map[string]route53.ListResourceRecordSetsOutput, error)
// GetHostedZones returns the Route53 HostedZones on the given input
// Returned values are commented in the interface doc comment block.
GetHostedZones(ctx context.Context, input *route53.ListHostedZonesInput) (map[string]route53.ListHostedZonesOutput, error)
// GetVPCAssociationAuthorizations returns the Route53 VPCAssociationAuthorizations on the given input
// Returned values are commented in the interface doc comment block.
GetVPCAssociationAuthorizations(ctx context.Context, input *route53.ListVPCAssociationAuthorizationsInput) (map[string]route53.ListVPCAssociationAuthorizationsOutput, error)
// GetResolverEndpoints returns the Route53Resolver ResolverEndpoints on the given input
// Returned values are commented in the interface doc comment block.
GetResolverEndpoints(ctx context.Context, input *route53resolver.ListResolverEndpointsInput) (map[string]route53resolver.ListResolverEndpointsOutput, error)
// GetResolverRules returns the Route53Resolver ResolverRules on the given input
// Returned values are commented in the interface doc comment block.
GetResolverRules(ctx context.Context, input *route53resolver.ListResolverRulesInput) (map[string]route53resolver.ListResolverRulesOutput, error)
// GetResolverRuleAssociations returns the Route53Resolver ResolverRuleAssociations on the given input
// Returned values are commented in the interface doc comment block.
GetResolverRuleAssociations(ctx context.Context, input *route53resolver.ListResolverRuleAssociationsInput) (map[string]route53resolver.ListResolverRuleAssociationsOutput, error)
}
func (c *connector) GetInstances(ctx context.Context, input *ec2.DescribeInstancesInput) (map[string]ec2.DescribeInstancesOutput, error) {
var errs Errors
var regionsOpts = map[string]ec2.DescribeInstancesOutput{}
for _, svc := range c.svcs {
if svc.ec2 == nil {
svc.ec2 = ec2.New(svc.session)
}
opt, err := svc.ec2.DescribeInstancesWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, ec2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetVpcs(ctx context.Context, input *ec2.DescribeVpcsInput) (map[string]ec2.DescribeVpcsOutput, error) {
var errs Errors
var regionsOpts = map[string]ec2.DescribeVpcsOutput{}
for _, svc := range c.svcs {
if svc.ec2 == nil {
svc.ec2 = ec2.New(svc.session)
}
opt, err := svc.ec2.DescribeVpcsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, ec2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetImages(ctx context.Context, input *ec2.DescribeImagesInput) (map[string]ec2.DescribeImagesOutput, error) {
var errs Errors
var regionsOpts = map[string]ec2.DescribeImagesOutput{}
for _, svc := range c.svcs {
if svc.ec2 == nil {
svc.ec2 = ec2.New(svc.session)
}
opt, err := svc.ec2.DescribeImagesWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, ec2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetOwnImages(ctx context.Context, input *ec2.DescribeImagesInput) (map[string]ec2.DescribeImagesOutput, error) {
var errs Errors
var regionsOpts = map[string]ec2.DescribeImagesOutput{}
if input == nil {
input = &ec2.DescribeImagesInput{}
}
input.Owners = append(input.Owners, c.accountID)
for _, svc := range c.svcs {
if svc.ec2 == nil {
svc.ec2 = ec2.New(svc.session)
}
opt, err := svc.ec2.DescribeImagesWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, ec2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetSecurityGroups(ctx context.Context, input *ec2.DescribeSecurityGroupsInput) (map[string]ec2.DescribeSecurityGroupsOutput, error) {
var errs Errors
var regionsOpts = map[string]ec2.DescribeSecurityGroupsOutput{}
for _, svc := range c.svcs {
if svc.ec2 == nil {
svc.ec2 = ec2.New(svc.session)
}
opt, err := svc.ec2.DescribeSecurityGroupsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, ec2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetSubnets(ctx context.Context, input *ec2.DescribeSubnetsInput) (map[string]ec2.DescribeSubnetsOutput, error) {
var errs Errors
var regionsOpts = map[string]ec2.DescribeSubnetsOutput{}
for _, svc := range c.svcs {
if svc.ec2 == nil {
svc.ec2 = ec2.New(svc.session)
}
opt, err := svc.ec2.DescribeSubnetsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, ec2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetVolumes(ctx context.Context, input *ec2.DescribeVolumesInput) (map[string]ec2.DescribeVolumesOutput, error) {
var errs Errors
var regionsOpts = map[string]ec2.DescribeVolumesOutput{}
for _, svc := range c.svcs {
if svc.ec2 == nil {
svc.ec2 = ec2.New(svc.session)
}
opt, err := svc.ec2.DescribeVolumesWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, ec2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetSnapshots(ctx context.Context, input *ec2.DescribeSnapshotsInput) (map[string]ec2.DescribeSnapshotsOutput, error) {
var errs Errors
var regionsOpts = map[string]ec2.DescribeSnapshotsOutput{}
for _, svc := range c.svcs {
if svc.ec2 == nil {
svc.ec2 = ec2.New(svc.session)
}
opt, err := svc.ec2.DescribeSnapshotsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, ec2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetOwnSnapshots(ctx context.Context, input *ec2.DescribeSnapshotsInput) (map[string]ec2.DescribeSnapshotsOutput, error) {
var errs Errors
var regionsOpts = map[string]ec2.DescribeSnapshotsOutput{}
if input == nil {
input = &ec2.DescribeSnapshotsInput{}
}
input.OwnerIds = append(input.OwnerIds, c.accountID)
for _, svc := range c.svcs {
if svc.ec2 == nil {
svc.ec2 = ec2.New(svc.session)
}
opt, err := svc.ec2.DescribeSnapshotsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, ec2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetLaunchTemplates(ctx context.Context, input *ec2.DescribeLaunchTemplatesInput) (map[string]ec2.DescribeLaunchTemplatesOutput, error) {
var errs Errors
var regionsOpts = map[string]ec2.DescribeLaunchTemplatesOutput{}
for _, svc := range c.svcs {
if svc.ec2 == nil {
svc.ec2 = ec2.New(svc.session)
}
opt, err := svc.ec2.DescribeLaunchTemplatesWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, ec2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetAutoScalingGroups(ctx context.Context, input *autoscaling.DescribeAutoScalingGroupsInput) (map[string]autoscaling.DescribeAutoScalingGroupsOutput, error) {
var errs Errors
var regionsOpts = map[string]autoscaling.DescribeAutoScalingGroupsOutput{}
for _, svc := range c.svcs {
if svc.autoscaling == nil {
svc.autoscaling = autoscaling.New(svc.session)
}
opt, err := svc.autoscaling.DescribeAutoScalingGroupsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, autoscaling.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetLaunchConfigurations(ctx context.Context, input *autoscaling.DescribeLaunchConfigurationsInput) (map[string]autoscaling.DescribeLaunchConfigurationsOutput, error) {
var errs Errors
var regionsOpts = map[string]autoscaling.DescribeLaunchConfigurationsOutput{}
for _, svc := range c.svcs {
if svc.autoscaling == nil {
svc.autoscaling = autoscaling.New(svc.session)
}
opt, err := svc.autoscaling.DescribeLaunchConfigurationsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, autoscaling.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetElastiCacheClusters(ctx context.Context, input *elasticache.DescribeCacheClustersInput) (map[string]elasticache.DescribeCacheClustersOutput, error) {
var errs Errors
var regionsOpts = map[string]elasticache.DescribeCacheClustersOutput{}
for _, svc := range c.svcs {
if svc.elasticache == nil {
svc.elasticache = elasticache.New(svc.session)
}
opt, err := svc.elasticache.DescribeCacheClustersWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, elasticache.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetElastiCacheTags(ctx context.Context, input *elasticache.ListTagsForResourceInput) (map[string]elasticache.TagListMessage, error) {
var errs Errors
var regionsOpts = map[string]elasticache.TagListMessage{}
for _, svc := range c.svcs {
if svc.elasticache == nil {
svc.elasticache = elasticache.New(svc.session)
}
opt, err := svc.elasticache.ListTagsForResourceWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, elasticache.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetLoadBalancers(ctx context.Context, input *elb.DescribeLoadBalancersInput) (map[string]elb.DescribeLoadBalancersOutput, error) {
var errs Errors
var regionsOpts = map[string]elb.DescribeLoadBalancersOutput{}
for _, svc := range c.svcs {
if svc.elb == nil {
svc.elb = elb.New(svc.session)
}
opt, err := svc.elb.DescribeLoadBalancersWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, elb.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetLoadBalancersTags(ctx context.Context, input *elb.DescribeTagsInput) (map[string]elb.DescribeTagsOutput, error) {
var errs Errors
var regionsOpts = map[string]elb.DescribeTagsOutput{}
for _, svc := range c.svcs {
if svc.elb == nil {
svc.elb = elb.New(svc.session)
}
opt, err := svc.elb.DescribeTagsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, elb.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetLoadBalancersV2(ctx context.Context, input *elbv2.DescribeLoadBalancersInput) (map[string]elbv2.DescribeLoadBalancersOutput, error) {
var errs Errors
var regionsOpts = map[string]elbv2.DescribeLoadBalancersOutput{}
for _, svc := range c.svcs {
if svc.elbv2 == nil {
svc.elbv2 = elbv2.New(svc.session)
}
opt, err := svc.elbv2.DescribeLoadBalancersWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, elbv2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetLoadBalancersV2Tags(ctx context.Context, input *elbv2.DescribeTagsInput) (map[string]elbv2.DescribeTagsOutput, error) {
var errs Errors
var regionsOpts = map[string]elbv2.DescribeTagsOutput{}
for _, svc := range c.svcs {
if svc.elbv2 == nil {
svc.elbv2 = elbv2.New(svc.session)
}
opt, err := svc.elbv2.DescribeTagsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, elbv2.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetDBInstances(ctx context.Context, input *rds.DescribeDBInstancesInput) (map[string]rds.DescribeDBInstancesOutput, error) {
var errs Errors
var regionsOpts = map[string]rds.DescribeDBInstancesOutput{}
for _, svc := range c.svcs {
if svc.rds == nil {
svc.rds = rds.New(svc.session)
}
opt, err := svc.rds.DescribeDBInstancesWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, rds.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetDBInstancesTags(ctx context.Context, input *rds.ListTagsForResourceInput) (map[string]rds.ListTagsForResourceOutput, error) {
var errs Errors
var regionsOpts = map[string]rds.ListTagsForResourceOutput{}
for _, svc := range c.svcs {
if svc.rds == nil {
svc.rds = rds.New(svc.session)
}
opt, err := svc.rds.ListTagsForResourceWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, rds.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetBucketTags(ctx context.Context, input *s3.GetBucketTaggingInput) (map[string]s3.GetBucketTaggingOutput, error) {
var errs Errors
var regionsOpts = map[string]s3.GetBucketTaggingOutput{}
for _, svc := range c.svcs {
if svc.s3 == nil {
svc.s3 = s3.New(svc.session)
}
opt, err := svc.s3.GetBucketTaggingWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, s3.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) ListObjects(ctx context.Context, input *s3.ListObjectsInput) (map[string]s3.ListObjectsOutput, error) {
var errs Errors
var regionsOpts = map[string]s3.ListObjectsOutput{}
for _, svc := range c.svcs {
if svc.s3 == nil {
svc.s3 = s3.New(svc.session)
}
opt, err := svc.s3.ListObjectsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, s3.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetObjectsTags(ctx context.Context, input *s3.GetObjectTaggingInput) (map[string]s3.GetObjectTaggingOutput, error) {
var errs Errors
var regionsOpts = map[string]s3.GetObjectTaggingOutput{}
for _, svc := range c.svcs {
if svc.s3 == nil {
svc.s3 = s3.New(svc.session)
}
opt, err := svc.s3.GetObjectTaggingWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, s3.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetRecordedResourceCounts(ctx context.Context, input *configservice.GetDiscoveredResourceCountsInput) (map[string]configservice.GetDiscoveredResourceCountsOutput, error) {
var errs Errors
var regionsOpts = map[string]configservice.GetDiscoveredResourceCountsOutput{}
for _, svc := range c.svcs {
if svc.configservice == nil {
svc.configservice = configservice.New(svc.session)
}
opt, err := svc.configservice.GetDiscoveredResourceCountsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, configservice.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetCloudFrontDistributions(ctx context.Context, input *cloudfront.ListDistributionsInput) (map[string]cloudfront.ListDistributionsOutput, error) {
var errs Errors
var regionsOpts = map[string]cloudfront.ListDistributionsOutput{}
for _, svc := range c.svcs {
if svc.cloudfront == nil {
svc.cloudfront = cloudfront.New(svc.session)
}
opt, err := svc.cloudfront.ListDistributionsWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, cloudfront.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetCloudFrontPublicKeys(ctx context.Context, input *cloudfront.ListPublicKeysInput) (map[string]cloudfront.ListPublicKeysOutput, error) {
var errs Errors
var regionsOpts = map[string]cloudfront.ListPublicKeysOutput{}
for _, svc := range c.svcs {
if svc.cloudfront == nil {
svc.cloudfront = cloudfront.New(svc.session)
}
opt, err := svc.cloudfront.ListPublicKeysWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, cloudfront.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetCloudFrontOriginAccessIdentities(ctx context.Context, input *cloudfront.ListCloudFrontOriginAccessIdentitiesInput) (map[string]cloudfront.ListCloudFrontOriginAccessIdentitiesOutput, error) {
var errs Errors
var regionsOpts = map[string]cloudfront.ListCloudFrontOriginAccessIdentitiesOutput{}
for _, svc := range c.svcs {
if svc.cloudfront == nil {
svc.cloudfront = cloudfront.New(svc.session)
}
opt, err := svc.cloudfront.ListCloudFrontOriginAccessIdentitiesWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, cloudfront.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetAccessKeys(ctx context.Context, input *iam.ListAccessKeysInput) (map[string]iam.ListAccessKeysOutput, error) {
var errs Errors
var regionsOpts = map[string]iam.ListAccessKeysOutput{}
for _, svc := range c.svcs {
if svc.iam == nil {
svc.iam = iam.New(svc.session)
}
opt, err := svc.iam.ListAccessKeysWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, iam.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {
return regionsOpts, errs
}
return regionsOpts, nil
}
func (c *connector) GetAccountAliases(ctx context.Context, input *iam.ListAccountAliasesInput) (map[string]iam.ListAccountAliasesOutput, error) {
var errs Errors
var regionsOpts = map[string]iam.ListAccountAliasesOutput{}
for _, svc := range c.svcs {
if svc.iam == nil {
svc.iam = iam.New(svc.session)
}
opt, err := svc.iam.ListAccountAliasesWithContext(ctx, input)
if err != nil {
errs = append(errs, NewError(svc.region, iam.ServiceName, err))
} else {
regionsOpts[svc.region] = *opt
}
}
if errs != nil {