1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'defaults_mode_config_resolver'
4
+
5
+ module Aws
6
+
7
+ # A defaults mode determines how certain default configuration options are resolved in the SDK.
8
+ #
9
+ # *Note*: For any mode other than `'legacy'` the vended default values might change as best practices may
10
+ # evolve. As a result, it is encouraged to perform testing when upgrading the SDK if you are using a mode other than
11
+ # `'legacy'`. While the `'legacy'` defaults mode is specific to Ruby,
12
+ # other modes are standardized across all of the AWS SDKs.
13
+ #
14
+ # The defaults mode can be configured:
15
+ #
16
+ # * Directly on a client via `:defaults_mode`
17
+ #
18
+ # * On a configuration profile via the "defaults_mode" profile file property.
19
+ #
20
+ # * Globally via the "AWS_DEFAULTS_MODE" environment variable.
21
+ #
22
+ #
23
+ # @code_generation START - documentation
24
+ # The following `:default_mode` values are supported:
25
+ #
26
+ # * `'standard'` -
27
+ # The STANDARD mode provides the latest recommended default values
28
+ # that should be safe to run in most scenarios
29
+ #
30
+ # Note that the default values vended from this mode might change as
31
+ # best practices may evolve. As a result, it is encouraged to perform
32
+ # tests when upgrading the SDK
33
+ #
34
+ # * `'in-region'` -
35
+ # The IN\_REGION mode builds on the standard mode and includes
36
+ # optimization tailored for applications which call AWS services from
37
+ # within the same AWS region
38
+ #
39
+ # Note that the default values vended from this mode might change as
40
+ # best practices may evolve. As a result, it is encouraged to perform
41
+ # tests when upgrading the SDK
42
+ #
43
+ # * `'cross-region'` -
44
+ # The CROSS\_REGION mode builds on the standard mode and includes
45
+ # optimization tailored for applications which call AWS services in a
46
+ # different region
47
+ #
48
+ # Note that the default values vended from this mode might change as
49
+ # best practices may evolve. As a result, it is encouraged to perform
50
+ # tests when upgrading the SDK
51
+ #
52
+ # * `'mobile'` -
53
+ # The MOBILE mode builds on the standard mode and includes
54
+ # optimization tailored for mobile applications
55
+ #
56
+ # Note that the default values vended from this mode might change as
57
+ # best practices may evolve. As a result, it is encouraged to perform
58
+ # tests when upgrading the SDK
59
+ #
60
+ # * `'auto'` -
61
+ # The AUTO mode is an experimental mode that builds on the standard
62
+ # mode. The SDK will attempt to discover the execution environment to
63
+ # determine the appropriate settings automatically.
64
+ #
65
+ # Note that the auto detection is heuristics-based and does not
66
+ # guarantee 100% accuracy. STANDARD mode will be used if the execution
67
+ # environment cannot be determined. The auto detection might query
68
+ # [EC2 Instance Metadata service][1], which might introduce latency.
69
+ # Therefore we recommend choosing an explicit defaults\_mode instead
70
+ # if startup latency is critical to your application
71
+ #
72
+ # * `'legacy'` -
73
+ # The LEGACY mode provides default settings that vary per SDK and were
74
+ # used prior to establishment of defaults\_mode
75
+ #
76
+ # Based on the provided mode, the SDK will vend sensible default values
77
+ # tailored to the mode for the following settings:
78
+ #
79
+ # * `:retry_mode` -
80
+ # A retry mode specifies how the SDK attempts retries. See [Retry
81
+ # Mode][2]
82
+ #
83
+ # * `:sts_regional_endpoints` -
84
+ # Specifies how the SDK determines the AWS service endpoint that it
85
+ # uses to talk to the AWS Security Token Service (AWS STS). See
86
+ # [Setting STS Regional endpoints][3]
87
+ #
88
+ # * `:s3_us_east_1_regional_endpoint` -
89
+ # Specifies how the SDK determines the AWS service endpoint that it
90
+ # uses to talk to the Amazon S3 for the us-east-1 region
91
+ #
92
+ # * `:http_open_timeout` -
93
+ # The amount of time after making an initial connection attempt on a
94
+ # socket, where if the client does not receive a completion of the
95
+ # connect handshake, the client gives up and fails the operation
96
+ #
97
+ # * `:ssl_timeout` -
98
+ # The maximum amount of time that a TLS handshake is allowed to take
99
+ # from the time the CLIENT HELLO message is sent to ethe time the
100
+ # client and server have fully negotiated ciphers and exchanged keys
101
+ #
102
+ # All options above can be configured by users, and the overridden value will take precedence.
103
+ #
104
+ # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
105
+ # [2]: https://docs.aws.amazon.com/sdkref/latest/guide/setting-global-retry_mode.html
106
+ # [3]: https://docs.aws.amazon.com/sdkref/latest/guide/setting-global-sts_regional_endpoints.html
107
+ #
108
+ # @code_generation END - documentation
109
+ module DefaultsModeConfiguration
110
+ # @api private
111
+ # @code_generation START - configuration
112
+ SDK_DEFAULT_CONFIGURATION =
113
+ {
114
+ "version" => 1 ,
115
+ "base" => {
116
+ "retryMode" => "standard" ,
117
+ "stsRegionalEndpoints" => "regional" ,
118
+ "s3UsEast1RegionalEndpoints" => "regional" ,
119
+ "connectTimeoutInMillis" => 1100 ,
120
+ "tlsNegotiationTimeoutInMillis" => 1100
121
+ } ,
122
+ "modes" => {
123
+ "standard" => {
124
+ "connectTimeoutInMillis" => {
125
+ "override" => 3100
126
+ } ,
127
+ "tlsNegotiationTimeoutInMillis" => {
128
+ "override" => 3100
129
+ }
130
+ } ,
131
+ "in-region" => {
132
+ } ,
133
+ "cross-region" => {
134
+ "connectTimeoutInMillis" => {
135
+ "override" => 3100
136
+ } ,
137
+ "tlsNegotiationTimeoutInMillis" => {
138
+ "override" => 3100
139
+ }
140
+ } ,
141
+ "mobile" => {
142
+ "connectTimeoutInMillis" => {
143
+ "override" => 30000
144
+ } ,
145
+ "tlsNegotiationTimeoutInMillis" => {
146
+ "override" => 30000
147
+ }
148
+ }
149
+ }
150
+ }
151
+ # @code_generation END - configuration
152
+ end
153
+ end
0 commit comments