1 package config
2
3 import (
4 "context"
5 "io"
6
7 "github.com/aws/aws-sdk-go-v2/aws"
8 "github.com/aws/aws-sdk-go-v2/credentials/ec2rolecreds"
9 "github.com/aws/aws-sdk-go-v2/credentials/endpointcreds"
10 "github.com/aws/aws-sdk-go-v2/credentials/processcreds"
11 "github.com/aws/aws-sdk-go-v2/credentials/ssocreds"
12 "github.com/aws/aws-sdk-go-v2/credentials/stscreds"
13 "github.com/aws/aws-sdk-go-v2/feature/ec2/imds"
14 smithybearer "github.com/aws/smithy-go/auth/bearer"
15 "github.com/aws/smithy-go/logging"
16 "github.com/aws/smithy-go/middleware"
17 )
18
19
20 type LoadOptionsFunc func(*LoadOptions) error
21
22
23
24 type LoadOptions struct {
25
26
27 Region string
28
29
30 Credentials aws.CredentialsProvider
31
32
33 BearerAuthTokenProvider smithybearer.TokenProvider
34
35
36 HTTPClient HTTPClient
37
38
39
40
41
42
43
44 EndpointResolver aws.EndpointResolver
45
46
47
48
49
50 EndpointResolverWithOptions aws.EndpointResolverWithOptions
51
52
53
54
55
56 RetryMaxAttempts int
57
58
59
60
61 RetryMode aws.RetryMode
62
63
64
65
66
67
68 Retryer func() aws.Retryer
69
70
71
72
73 APIOptions []func(*middleware.Stack) error
74
75
76 Logger logging.Logger
77
78
79
80
81
82
83
84 ClientLogMode *aws.ClientLogMode
85
86
87 SharedConfigProfile string
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102 SharedConfigFiles []string
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118 SharedCredentialsFiles []string
119
120
121 CustomCABundle io.Reader
122
123
124
125 DefaultRegion string
126
127
128
129 UseEC2IMDSRegion *UseEC2IMDSRegion
130
131
132
133 CredentialsCacheOptions func(*aws.CredentialsCacheOptions)
134
135
136
137 BearerAuthTokenCacheOptions func(*smithybearer.TokenCacheOptions)
138
139
140
141 SSOTokenProviderOptions func(*ssocreds.SSOTokenProviderOptions)
142
143
144
145 ProcessCredentialOptions func(*processcreds.Options)
146
147
148
149 EC2RoleCredentialOptions func(*ec2rolecreds.Options)
150
151
152
153 EndpointCredentialOptions func(*endpointcreds.Options)
154
155
156
157 WebIdentityRoleCredentialOptions func(*stscreds.WebIdentityRoleOptions)
158
159
160
161 AssumeRoleCredentialOptions func(*stscreds.AssumeRoleOptions)
162
163
164
165 SSOProviderOptions func(options *ssocreds.Options)
166
167
168
169 LogConfigurationWarnings *bool
170
171
172
173 S3UseARNRegion *bool
174
175
176
177 S3DisableMultiRegionAccessPoints *bool
178
179
180
181 EnableEndpointDiscovery aws.EndpointDiscoveryEnableState
182
183
184
185
186 EC2IMDSClientEnableState imds.ClientEnableState
187
188
189
190 EC2IMDSEndpointMode imds.EndpointModeState
191
192
193
194 EC2IMDSEndpoint string
195
196
197
198 UseDualStackEndpoint aws.DualStackEndpointState
199
200
201
202 UseFIPSEndpoint aws.FIPSEndpointState
203
204
205 DefaultsModeOptions DefaultsModeOptions
206
207
208 AppID string
209
210
211 DisableRequestCompression *bool
212
213
214 RequestMinCompressSizeBytes *int64
215
216
217 S3DisableExpressAuth *bool
218 }
219
220 func (o LoadOptions) getDefaultsMode(ctx context.Context) (aws.DefaultsMode, bool, error) {
221 if len(o.DefaultsModeOptions.Mode) == 0 {
222 return "", false, nil
223 }
224 return o.DefaultsModeOptions.Mode, true, nil
225 }
226
227
228
229 func (o LoadOptions) GetRetryMaxAttempts(ctx context.Context) (int, bool, error) {
230 if o.RetryMaxAttempts == 0 {
231 return 0, false, nil
232 }
233 return o.RetryMaxAttempts, true, nil
234 }
235
236
237 func (o LoadOptions) GetRetryMode(ctx context.Context) (aws.RetryMode, bool, error) {
238 if len(o.RetryMode) == 0 {
239 return "", false, nil
240 }
241 return o.RetryMode, true, nil
242 }
243
244 func (o LoadOptions) getDefaultsModeIMDSClient(ctx context.Context) (*imds.Client, bool, error) {
245 if o.DefaultsModeOptions.IMDSClient == nil {
246 return nil, false, nil
247 }
248 return o.DefaultsModeOptions.IMDSClient, true, nil
249 }
250
251
252 func (o LoadOptions) getRegion(ctx context.Context) (string, bool, error) {
253 if len(o.Region) == 0 {
254 return "", false, nil
255 }
256
257 return o.Region, true, nil
258 }
259
260
261 func (o LoadOptions) getAppID(ctx context.Context) (string, bool, error) {
262 return o.AppID, len(o.AppID) > 0, nil
263 }
264
265
266 func (o LoadOptions) getDisableRequestCompression(ctx context.Context) (bool, bool, error) {
267 if o.DisableRequestCompression == nil {
268 return false, false, nil
269 }
270 return *o.DisableRequestCompression, true, nil
271 }
272
273
274 func (o LoadOptions) getRequestMinCompressSizeBytes(ctx context.Context) (int64, bool, error) {
275 if o.RequestMinCompressSizeBytes == nil {
276 return 0, false, nil
277 }
278 return *o.RequestMinCompressSizeBytes, true, nil
279 }
280
281
282
283
284
285
286 func WithRegion(v string) LoadOptionsFunc {
287 return func(o *LoadOptions) error {
288 o.Region = v
289 return nil
290 }
291 }
292
293
294
295 func WithAppID(ID string) LoadOptionsFunc {
296 return func(o *LoadOptions) error {
297 o.AppID = ID
298 return nil
299 }
300 }
301
302
303
304 func WithDisableRequestCompression(DisableRequestCompression *bool) LoadOptionsFunc {
305 return func(o *LoadOptions) error {
306 if DisableRequestCompression == nil {
307 return nil
308 }
309 o.DisableRequestCompression = DisableRequestCompression
310 return nil
311 }
312 }
313
314
315
316 func WithRequestMinCompressSizeBytes(RequestMinCompressSizeBytes *int64) LoadOptionsFunc {
317 return func(o *LoadOptions) error {
318 if RequestMinCompressSizeBytes == nil {
319 return nil
320 }
321 o.RequestMinCompressSizeBytes = RequestMinCompressSizeBytes
322 return nil
323 }
324 }
325
326
327 func (o LoadOptions) getDefaultRegion(ctx context.Context) (string, bool, error) {
328 if len(o.DefaultRegion) == 0 {
329 return "", false, nil
330 }
331
332 return o.DefaultRegion, true, nil
333 }
334
335
336
337
338
339
340
341
342 func WithDefaultRegion(v string) LoadOptionsFunc {
343 return func(o *LoadOptions) error {
344 o.DefaultRegion = v
345 return nil
346 }
347 }
348
349
350 func (o LoadOptions) getSharedConfigProfile(ctx context.Context) (string, bool, error) {
351 if len(o.SharedConfigProfile) == 0 {
352 return "", false, nil
353 }
354
355 return o.SharedConfigProfile, true, nil
356 }
357
358
359
360
361
362
363
364 func WithSharedConfigProfile(v string) LoadOptionsFunc {
365 return func(o *LoadOptions) error {
366 o.SharedConfigProfile = v
367 return nil
368 }
369 }
370
371
372 func (o LoadOptions) getSharedConfigFiles(ctx context.Context) ([]string, bool, error) {
373 if o.SharedConfigFiles == nil {
374 return nil, false, nil
375 }
376
377 return o.SharedConfigFiles, true, nil
378 }
379
380
381
382
383
384
385
386 func WithSharedConfigFiles(v []string) LoadOptionsFunc {
387 return func(o *LoadOptions) error {
388 o.SharedConfigFiles = v
389 return nil
390 }
391 }
392
393
394 func (o LoadOptions) getSharedCredentialsFiles(ctx context.Context) ([]string, bool, error) {
395 if o.SharedCredentialsFiles == nil {
396 return nil, false, nil
397 }
398
399 return o.SharedCredentialsFiles, true, nil
400 }
401
402
403
404
405
406
407
408 func WithSharedCredentialsFiles(v []string) LoadOptionsFunc {
409 return func(o *LoadOptions) error {
410 o.SharedCredentialsFiles = v
411 return nil
412 }
413 }
414
415
416 func (o LoadOptions) getCustomCABundle(ctx context.Context) (io.Reader, bool, error) {
417 if o.CustomCABundle == nil {
418 return nil, false, nil
419 }
420
421 return o.CustomCABundle, true, nil
422 }
423
424
425
426
427
428
429 func WithCustomCABundle(v io.Reader) LoadOptionsFunc {
430 return func(o *LoadOptions) error {
431 o.CustomCABundle = v
432 return nil
433 }
434 }
435
436
437
438 type UseEC2IMDSRegion struct {
439
440 Client *imds.Client
441 }
442
443
444 func (p *UseEC2IMDSRegion) getRegion(ctx context.Context) (string, bool, error) {
445 if ctx == nil {
446 ctx = context.Background()
447 }
448
449 client := p.Client
450 if client == nil {
451 client = imds.New(imds.Options{})
452 }
453
454 result, err := client.GetRegion(ctx, nil)
455 if err != nil {
456 return "", false, err
457 }
458 if len(result.Region) != 0 {
459 return result.Region, true, nil
460 }
461 return "", false, nil
462 }
463
464
465 func (o LoadOptions) getEC2IMDSRegion(ctx context.Context) (string, bool, error) {
466 if o.UseEC2IMDSRegion == nil {
467 return "", false, nil
468 }
469
470 return o.UseEC2IMDSRegion.getRegion(ctx)
471 }
472
473
474
475
476
477
478
479
480
481 func WithEC2IMDSRegion(fnOpts ...func(o *UseEC2IMDSRegion)) LoadOptionsFunc {
482 return func(o *LoadOptions) error {
483 o.UseEC2IMDSRegion = &UseEC2IMDSRegion{}
484
485 for _, fn := range fnOpts {
486 fn(o.UseEC2IMDSRegion)
487 }
488 return nil
489 }
490 }
491
492
493 func (o LoadOptions) getCredentialsProvider(ctx context.Context) (aws.CredentialsProvider, bool, error) {
494 if o.Credentials == nil {
495 return nil, false, nil
496 }
497
498 return o.Credentials, true, nil
499 }
500
501
502
503
504
505
506 func WithCredentialsProvider(v aws.CredentialsProvider) LoadOptionsFunc {
507 return func(o *LoadOptions) error {
508 o.Credentials = v
509 return nil
510 }
511 }
512
513
514 func (o LoadOptions) getCredentialsCacheOptions(ctx context.Context) (func(*aws.CredentialsCacheOptions), bool, error) {
515 if o.CredentialsCacheOptions == nil {
516 return nil, false, nil
517 }
518
519 return o.CredentialsCacheOptions, true, nil
520 }
521
522
523
524
525
526
527
528
529 func WithCredentialsCacheOptions(v func(*aws.CredentialsCacheOptions)) LoadOptionsFunc {
530 return func(o *LoadOptions) error {
531 o.CredentialsCacheOptions = v
532 return nil
533 }
534 }
535
536
537 func (o LoadOptions) getBearerAuthTokenProvider(ctx context.Context) (smithybearer.TokenProvider, bool, error) {
538 if o.BearerAuthTokenProvider == nil {
539 return nil, false, nil
540 }
541
542 return o.BearerAuthTokenProvider, true, nil
543 }
544
545
546
547
548
549
550 func WithBearerAuthTokenProvider(v smithybearer.TokenProvider) LoadOptionsFunc {
551 return func(o *LoadOptions) error {
552 o.BearerAuthTokenProvider = v
553 return nil
554 }
555 }
556
557
558 func (o LoadOptions) getBearerAuthTokenCacheOptions(ctx context.Context) (func(*smithybearer.TokenCacheOptions), bool, error) {
559 if o.BearerAuthTokenCacheOptions == nil {
560 return nil, false, nil
561 }
562
563 return o.BearerAuthTokenCacheOptions, true, nil
564 }
565
566
567
568
569
570
571
572
573 func WithBearerAuthTokenCacheOptions(v func(*smithybearer.TokenCacheOptions)) LoadOptionsFunc {
574 return func(o *LoadOptions) error {
575 o.BearerAuthTokenCacheOptions = v
576 return nil
577 }
578 }
579
580
581 func (o LoadOptions) getSSOTokenProviderOptions(ctx context.Context) (func(*ssocreds.SSOTokenProviderOptions), bool, error) {
582 if o.SSOTokenProviderOptions == nil {
583 return nil, false, nil
584 }
585
586 return o.SSOTokenProviderOptions, true, nil
587 }
588
589
590
591
592
593
594
595
596 func WithSSOTokenProviderOptions(v func(*ssocreds.SSOTokenProviderOptions)) LoadOptionsFunc {
597 return func(o *LoadOptions) error {
598 o.SSOTokenProviderOptions = v
599 return nil
600 }
601 }
602
603
604 func (o LoadOptions) getProcessCredentialOptions(ctx context.Context) (func(*processcreds.Options), bool, error) {
605 if o.ProcessCredentialOptions == nil {
606 return nil, false, nil
607 }
608
609 return o.ProcessCredentialOptions, true, nil
610 }
611
612
613
614
615
616
617 func WithProcessCredentialOptions(v func(*processcreds.Options)) LoadOptionsFunc {
618 return func(o *LoadOptions) error {
619 o.ProcessCredentialOptions = v
620 return nil
621 }
622 }
623
624
625 func (o LoadOptions) getEC2RoleCredentialOptions(ctx context.Context) (func(*ec2rolecreds.Options), bool, error) {
626 if o.EC2RoleCredentialOptions == nil {
627 return nil, false, nil
628 }
629
630 return o.EC2RoleCredentialOptions, true, nil
631 }
632
633
634
635
636
637
638 func WithEC2RoleCredentialOptions(v func(*ec2rolecreds.Options)) LoadOptionsFunc {
639 return func(o *LoadOptions) error {
640 o.EC2RoleCredentialOptions = v
641 return nil
642 }
643 }
644
645
646 func (o LoadOptions) getEndpointCredentialOptions(context.Context) (func(*endpointcreds.Options), bool, error) {
647 if o.EndpointCredentialOptions == nil {
648 return nil, false, nil
649 }
650
651 return o.EndpointCredentialOptions, true, nil
652 }
653
654
655
656
657
658
659 func WithEndpointCredentialOptions(v func(*endpointcreds.Options)) LoadOptionsFunc {
660 return func(o *LoadOptions) error {
661 o.EndpointCredentialOptions = v
662 return nil
663 }
664 }
665
666
667 func (o LoadOptions) getWebIdentityRoleCredentialOptions(context.Context) (func(*stscreds.WebIdentityRoleOptions), bool, error) {
668 if o.WebIdentityRoleCredentialOptions == nil {
669 return nil, false, nil
670 }
671
672 return o.WebIdentityRoleCredentialOptions, true, nil
673 }
674
675
676
677
678
679
680
681 func WithWebIdentityRoleCredentialOptions(v func(*stscreds.WebIdentityRoleOptions)) LoadOptionsFunc {
682 return func(o *LoadOptions) error {
683 o.WebIdentityRoleCredentialOptions = v
684 return nil
685 }
686 }
687
688
689 func (o LoadOptions) getAssumeRoleCredentialOptions(context.Context) (func(options *stscreds.AssumeRoleOptions), bool, error) {
690 if o.AssumeRoleCredentialOptions == nil {
691 return nil, false, nil
692 }
693
694 return o.AssumeRoleCredentialOptions, true, nil
695 }
696
697
698
699
700
701
702
703 func WithAssumeRoleCredentialOptions(v func(*stscreds.AssumeRoleOptions)) LoadOptionsFunc {
704 return func(o *LoadOptions) error {
705 o.AssumeRoleCredentialOptions = v
706 return nil
707 }
708 }
709
710 func (o LoadOptions) getHTTPClient(ctx context.Context) (HTTPClient, bool, error) {
711 if o.HTTPClient == nil {
712 return nil, false, nil
713 }
714
715 return o.HTTPClient, true, nil
716 }
717
718
719
720
721
722
723 func WithHTTPClient(v HTTPClient) LoadOptionsFunc {
724 return func(o *LoadOptions) error {
725 o.HTTPClient = v
726 return nil
727 }
728 }
729
730 func (o LoadOptions) getAPIOptions(ctx context.Context) ([]func(*middleware.Stack) error, bool, error) {
731 if o.APIOptions == nil {
732 return nil, false, nil
733 }
734
735 return o.APIOptions, true, nil
736 }
737
738
739
740
741
742 func WithAPIOptions(v []func(*middleware.Stack) error) LoadOptionsFunc {
743 return func(o *LoadOptions) error {
744 if v == nil {
745 return nil
746 }
747
748 o.APIOptions = append(o.APIOptions, v...)
749 return nil
750 }
751 }
752
753 func (o LoadOptions) getRetryMaxAttempts(ctx context.Context) (int, bool, error) {
754 if o.RetryMaxAttempts == 0 {
755 return 0, false, nil
756 }
757
758 return o.RetryMaxAttempts, true, nil
759 }
760
761
762
763
764
765
766
767 func WithRetryMaxAttempts(v int) LoadOptionsFunc {
768 return func(o *LoadOptions) error {
769 o.RetryMaxAttempts = v
770 return nil
771 }
772 }
773
774 func (o LoadOptions) getRetryMode(ctx context.Context) (aws.RetryMode, bool, error) {
775 if o.RetryMode == "" {
776 return "", false, nil
777 }
778
779 return o.RetryMode, true, nil
780 }
781
782
783
784
785
786
787
788 func WithRetryMode(v aws.RetryMode) LoadOptionsFunc {
789 return func(o *LoadOptions) error {
790 o.RetryMode = v
791 return nil
792 }
793 }
794
795 func (o LoadOptions) getRetryer(ctx context.Context) (func() aws.Retryer, bool, error) {
796 if o.Retryer == nil {
797 return nil, false, nil
798 }
799
800 return o.Retryer, true, nil
801 }
802
803
804
805
806
807 func WithRetryer(v func() aws.Retryer) LoadOptionsFunc {
808 return func(o *LoadOptions) error {
809 o.Retryer = v
810 return nil
811 }
812 }
813
814 func (o LoadOptions) getEndpointResolver(ctx context.Context) (aws.EndpointResolver, bool, error) {
815 if o.EndpointResolver == nil {
816 return nil, false, nil
817 }
818
819 return o.EndpointResolver, true, nil
820 }
821
822
823
824
825
826
827
828 func WithEndpointResolver(v aws.EndpointResolver) LoadOptionsFunc {
829 return func(o *LoadOptions) error {
830 o.EndpointResolver = v
831 return nil
832 }
833 }
834
835 func (o LoadOptions) getEndpointResolverWithOptions(ctx context.Context) (aws.EndpointResolverWithOptions, bool, error) {
836 if o.EndpointResolverWithOptions == nil {
837 return nil, false, nil
838 }
839
840 return o.EndpointResolverWithOptions, true, nil
841 }
842
843
844
845
846
847 func WithEndpointResolverWithOptions(v aws.EndpointResolverWithOptions) LoadOptionsFunc {
848 return func(o *LoadOptions) error {
849 o.EndpointResolverWithOptions = v
850 return nil
851 }
852 }
853
854 func (o LoadOptions) getLogger(ctx context.Context) (logging.Logger, bool, error) {
855 if o.Logger == nil {
856 return nil, false, nil
857 }
858
859 return o.Logger, true, nil
860 }
861
862
863
864
865
866 func WithLogger(v logging.Logger) LoadOptionsFunc {
867 return func(o *LoadOptions) error {
868 o.Logger = v
869 return nil
870 }
871 }
872
873 func (o LoadOptions) getClientLogMode(ctx context.Context) (aws.ClientLogMode, bool, error) {
874 if o.ClientLogMode == nil {
875 return 0, false, nil
876 }
877
878 return *o.ClientLogMode, true, nil
879 }
880
881
882
883
884
885 func WithClientLogMode(v aws.ClientLogMode) LoadOptionsFunc {
886 return func(o *LoadOptions) error {
887 o.ClientLogMode = &v
888 return nil
889 }
890 }
891
892 func (o LoadOptions) getLogConfigurationWarnings(ctx context.Context) (v bool, found bool, err error) {
893 if o.LogConfigurationWarnings == nil {
894 return false, false, nil
895 }
896 return *o.LogConfigurationWarnings, true, nil
897 }
898
899
900
901
902
903
904
905 func WithLogConfigurationWarnings(v bool) LoadOptionsFunc {
906 return func(o *LoadOptions) error {
907 o.LogConfigurationWarnings = &v
908 return nil
909 }
910 }
911
912
913
914 func (o LoadOptions) GetS3UseARNRegion(ctx context.Context) (v bool, found bool, err error) {
915 if o.S3UseARNRegion == nil {
916 return false, false, nil
917 }
918 return *o.S3UseARNRegion, true, nil
919 }
920
921
922
923
924
925 func WithS3UseARNRegion(v bool) LoadOptionsFunc {
926 return func(o *LoadOptions) error {
927 o.S3UseARNRegion = &v
928 return nil
929 }
930 }
931
932
933
934 func (o LoadOptions) GetS3DisableMultiRegionAccessPoints(ctx context.Context) (v bool, found bool, err error) {
935 if o.S3DisableMultiRegionAccessPoints == nil {
936 return false, false, nil
937 }
938 return *o.S3DisableMultiRegionAccessPoints, true, nil
939 }
940
941
942
943
944
945 func WithS3DisableMultiRegionAccessPoints(v bool) LoadOptionsFunc {
946 return func(o *LoadOptions) error {
947 o.S3DisableMultiRegionAccessPoints = &v
948 return nil
949 }
950 }
951
952
953 func (o LoadOptions) GetEnableEndpointDiscovery(ctx context.Context) (value aws.EndpointDiscoveryEnableState, ok bool, err error) {
954 if o.EnableEndpointDiscovery == aws.EndpointDiscoveryUnset {
955 return aws.EndpointDiscoveryUnset, false, nil
956 }
957 return o.EnableEndpointDiscovery, true, nil
958 }
959
960
961
962
963
964 func WithEndpointDiscovery(v aws.EndpointDiscoveryEnableState) LoadOptionsFunc {
965 return func(o *LoadOptions) error {
966 o.EnableEndpointDiscovery = v
967 return nil
968 }
969 }
970
971
972 func (o LoadOptions) getSSOProviderOptions(context.Context) (func(options *ssocreds.Options), bool, error) {
973 if o.SSOProviderOptions == nil {
974 return nil, false, nil
975 }
976
977 return o.SSOProviderOptions, true, nil
978 }
979
980
981
982
983
984
985
986 func WithSSOProviderOptions(v func(*ssocreds.Options)) LoadOptionsFunc {
987 return func(o *LoadOptions) error {
988 o.SSOProviderOptions = v
989 return nil
990 }
991 }
992
993
994 func (o LoadOptions) GetEC2IMDSClientEnableState() (imds.ClientEnableState, bool, error) {
995 if o.EC2IMDSClientEnableState == imds.ClientDefaultEnableState {
996 return imds.ClientDefaultEnableState, false, nil
997 }
998
999 return o.EC2IMDSClientEnableState, true, nil
1000 }
1001
1002
1003 func (o LoadOptions) GetEC2IMDSEndpointMode() (imds.EndpointModeState, bool, error) {
1004 if o.EC2IMDSEndpointMode == imds.EndpointModeStateUnset {
1005 return imds.EndpointModeStateUnset, false, nil
1006 }
1007
1008 return o.EC2IMDSEndpointMode, true, nil
1009 }
1010
1011
1012 func (o LoadOptions) GetEC2IMDSEndpoint() (string, bool, error) {
1013 if len(o.EC2IMDSEndpoint) == 0 {
1014 return "", false, nil
1015 }
1016
1017 return o.EC2IMDSEndpoint, true, nil
1018 }
1019
1020
1021 func WithEC2IMDSClientEnableState(v imds.ClientEnableState) LoadOptionsFunc {
1022 return func(o *LoadOptions) error {
1023 o.EC2IMDSClientEnableState = v
1024 return nil
1025 }
1026 }
1027
1028
1029 func WithEC2IMDSEndpointMode(v imds.EndpointModeState) LoadOptionsFunc {
1030 return func(o *LoadOptions) error {
1031 o.EC2IMDSEndpointMode = v
1032 return nil
1033 }
1034 }
1035
1036
1037 func WithEC2IMDSEndpoint(v string) LoadOptionsFunc {
1038 return func(o *LoadOptions) error {
1039 o.EC2IMDSEndpoint = v
1040 return nil
1041 }
1042 }
1043
1044
1045
1046 func WithUseDualStackEndpoint(v aws.DualStackEndpointState) LoadOptionsFunc {
1047 return func(o *LoadOptions) error {
1048 o.UseDualStackEndpoint = v
1049 return nil
1050 }
1051 }
1052
1053
1054
1055 func (o LoadOptions) GetUseDualStackEndpoint(ctx context.Context) (value aws.DualStackEndpointState, found bool, err error) {
1056 if o.UseDualStackEndpoint == aws.DualStackEndpointStateUnset {
1057 return aws.DualStackEndpointStateUnset, false, nil
1058 }
1059 return o.UseDualStackEndpoint, true, nil
1060 }
1061
1062
1063
1064 func WithUseFIPSEndpoint(v aws.FIPSEndpointState) LoadOptionsFunc {
1065 return func(o *LoadOptions) error {
1066 o.UseFIPSEndpoint = v
1067 return nil
1068 }
1069 }
1070
1071
1072
1073 func (o LoadOptions) GetUseFIPSEndpoint(ctx context.Context) (value aws.FIPSEndpointState, found bool, err error) {
1074 if o.UseFIPSEndpoint == aws.FIPSEndpointStateUnset {
1075 return aws.FIPSEndpointStateUnset, false, nil
1076 }
1077 return o.UseFIPSEndpoint, true, nil
1078 }
1079
1080
1081
1082
1083
1084 func WithDefaultsMode(mode aws.DefaultsMode, optFns ...func(options *DefaultsModeOptions)) LoadOptionsFunc {
1085 do := DefaultsModeOptions{
1086 Mode: mode,
1087 }
1088 for _, fn := range optFns {
1089 fn(&do)
1090 }
1091 return func(options *LoadOptions) error {
1092 options.DefaultsModeOptions = do
1093 return nil
1094 }
1095 }
1096
1097
1098
1099 func (o LoadOptions) GetS3DisableExpressAuth() (value, ok bool) {
1100 if o.S3DisableExpressAuth == nil {
1101 return false, false
1102 }
1103
1104 return *o.S3DisableExpressAuth, true
1105 }
1106
1107
1108
1109 func WithS3DisableExpressAuth(v bool) LoadOptionsFunc {
1110 return func(o *LoadOptions) error {
1111 o.S3DisableExpressAuth = &v
1112 return nil
1113 }
1114 }
1115
View as plain text