Skip to content

Commit 14a7e38

Browse files
Merge branch 'release-1.37.5'
* release-1.37.5: Bumping version to 1.37.5 Update endpoints model Update to latest models Bump codecov/codecov-action from 5.3.1 to 5.4.0 Configure host prefix injection
2 parents 923a20f + 5d650ef commit 14a7e38

File tree

17 files changed

+1192
-543
lines changed

17 files changed

+1192
-543
lines changed

.changes/1.37.5.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[
2+
{
3+
"category": "``cognito-idp``",
4+
"description": "Added the capacity to return available challenges in admin authentication and to set version 3 of the pre token generation event for M2M ATC.",
5+
"type": "api-change"
6+
},
7+
{
8+
"category": "``ec2``",
9+
"description": "Update the DescribeVpcs response",
10+
"type": "api-change"
11+
},
12+
{
13+
"category": "``qbusiness``",
14+
"description": "Adds support for the ingestion of audio and video files by Q Business, which can be configured with the mediaExtractionConfiguration parameter.",
15+
"type": "api-change"
16+
},
17+
{
18+
"category": "``rum``",
19+
"description": "Add support for PutResourcePolicy, GetResourcePolicy and DeleteResourcePolicy to support resource based policies for AWS CloudWatch RUM",
20+
"type": "api-change"
21+
},
22+
{
23+
"category": "``sagemaker``",
24+
"description": "Add DomainId to CreateDomainResponse",
25+
"type": "api-change"
26+
},
27+
{
28+
"category": "``transcribe``",
29+
"description": "Updating documentation for post call analytics job queueing.",
30+
"type": "api-change"
31+
},
32+
{
33+
"category": "configuration",
34+
"description": "Add support for disabling host prefix injection via the ``AWS_DISABLE_HOST_PREFIX_INJECTION`` environment variable or the ``disable_host_prefix_injection`` parameter in the shared aws configuration file.",
35+
"type": "enhancement"
36+
}
37+
]

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: |
3333
python scripts/ci/run-tests --with-cov --with-xdist
3434
- name: Run codecov
35-
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3
35+
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574
3636
with:
3737
directory: tests
3838

CHANGELOG.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
CHANGELOG
33
=========
44

5+
1.37.5
6+
======
7+
8+
* api-change:``cognito-idp``: Added the capacity to return available challenges in admin authentication and to set version 3 of the pre token generation event for M2M ATC.
9+
* api-change:``ec2``: Update the DescribeVpcs response
10+
* api-change:``qbusiness``: Adds support for the ingestion of audio and video files by Q Business, which can be configured with the mediaExtractionConfiguration parameter.
11+
* api-change:``rum``: Add support for PutResourcePolicy, GetResourcePolicy and DeleteResourcePolicy to support resource based policies for AWS CloudWatch RUM
12+
* api-change:``sagemaker``: Add DomainId to CreateDomainResponse
13+
* api-change:``transcribe``: Updating documentation for post call analytics job queueing.
14+
* enhancement:configuration: Add support for disabling host prefix injection via the ``AWS_DISABLE_HOST_PREFIX_INJECTION`` environment variable or the ``disable_host_prefix_injection`` parameter in the shared aws configuration file.
15+
16+
517
1.37.4
618
======
719

botocore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import os
1717
import re
1818

19-
__version__ = '1.37.4'
19+
__version__ = '1.37.5'
2020

2121

2222
class NullHandler(logging.Handler):

botocore/args.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ def compute_client_args(
315315
self._compute_sigv4a_signing_region_set_config(config_kwargs)
316316
self._compute_checksum_config(config_kwargs)
317317
self._compute_account_id_endpoint_mode_config(config_kwargs)
318+
self._compute_inject_host_prefix(client_config, config_kwargs)
318319
s3_config = self.compute_s3_config(client_config)
319320

320321
is_s3_service = self._is_s3_service(service_name)
@@ -337,6 +338,25 @@ def compute_client_args(
337338
),
338339
}
339340

341+
def _compute_inject_host_prefix(self, client_config, config_kwargs):
342+
# In the cases that a Config object was not provided, or the private value
343+
# remained UNSET, we should resolve the value from the config store.
344+
if (
345+
client_config is None
346+
or client_config._inject_host_prefix == 'UNSET'
347+
):
348+
configured_disable_host_prefix_injection = (
349+
self._config_store.get_config_variable(
350+
'disable_host_prefix_injection'
351+
)
352+
)
353+
if configured_disable_host_prefix_injection is not None:
354+
config_kwargs[
355+
'inject_host_prefix'
356+
] = not configured_disable_host_prefix_injection
357+
else:
358+
config_kwargs['inject_host_prefix'] = True
359+
340360
def _compute_configured_endpoint_url(self, client_config, endpoint_url):
341361
if endpoint_url is not None:
342362
return endpoint_url

botocore/config.py

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,14 @@ class Config:
176176
:type inject_host_prefix: bool
177177
:param inject_host_prefix: Whether host prefix injection should occur.
178178
179-
Defaults to True.
179+
Defaults to None.
180180
181+
The default of None is equivalent to setting to True, which enables
182+
the injection of operation parameters into the prefix of the hostname.
181183
Setting this to False disables the injection of operation parameters
182-
into the prefix of the hostname. This is useful for clients providing
183-
custom endpoints that should not have their host prefix modified.
184+
into the prefix of the hostname. Setting this to False is useful for
185+
clients providing custom endpoints that should not have their host
186+
prefix modified.
184187
185188
:type use_dualstack_endpoint: bool
186189
:param use_dualstack_endpoint: Setting to True enables dualstack
@@ -297,7 +300,7 @@ class Config:
297300
('s3', None),
298301
('retries', None),
299302
('client_cert', None),
300-
('inject_host_prefix', True),
303+
('inject_host_prefix', None),
301304
('endpoint_discovery_enabled', None),
302305
('use_dualstack_endpoint', None),
303306
('use_fips_endpoint', None),
@@ -318,22 +321,57 @@ class Config:
318321
'connect_timeout': None,
319322
}
320323

324+
# The original default value of the inject_host_prefix parameter was True.
325+
# This prevented the ability to override the value from other locations in
326+
# the parameter provider chain, like env vars or the shared configuration
327+
# file. TO accomplish this, we need to disambiguate when the value was set
328+
# by the user or not. This overrides the parameter with a property so the
329+
# default value of inject_host_prefix is still True if it is not set by the
330+
# user.
331+
@property
332+
def inject_host_prefix(self):
333+
if self._inject_host_prefix == "UNSET":
334+
return True
335+
336+
return self._inject_host_prefix
337+
338+
# Override the setter for the case where the user does supply a value;
339+
# _inject_host_prefix will no longer be "UNSET".
340+
@inject_host_prefix.setter
341+
def inject_host_prefix(self, value):
342+
self._inject_host_prefix = value
343+
321344
def __init__(self, *args, **kwargs):
322345
self._user_provided_options = self._record_user_provided_options(
323346
args, kwargs
324347
)
325348

349+
# By default, we use a value that indicates the user did not
350+
# set it. This value MUST persist on the Config object to be used
351+
# elsewhere.
352+
self._inject_host_prefix = 'UNSET'
353+
326354
# Merge the user_provided options onto the default options
327355
config_vars = copy.copy(self.OPTION_DEFAULTS)
328356
defaults_mode = self._user_provided_options.get(
329357
'defaults_mode', 'legacy'
330358
)
331359
if defaults_mode != 'legacy':
332360
config_vars.update(self.NON_LEGACY_OPTION_DEFAULTS)
361+
333362
config_vars.update(self._user_provided_options)
334363

335364
# Set the attributes based on the config_vars
336365
for key, value in config_vars.items():
366+
# Default values for the Config object are set here. We don't want
367+
# to use `setattr` in the case where the user already supplied a
368+
# value.
369+
if (
370+
key == 'inject_host_prefix'
371+
and 'inject_host_prefix'
372+
not in self._user_provided_options.keys()
373+
):
374+
continue
337375
setattr(self, key, value)
338376

339377
# Validate the s3 options

botocore/configprovider.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@
186186
'preferred',
187187
None,
188188
),
189+
'disable_host_prefix_injection': (
190+
'disable_host_prefix_injection',
191+
'AWS_DISABLE_HOST_PREFIX_INJECTION',
192+
None,
193+
utils.ensure_boolean,
194+
),
189195
}
190196

191197
# Evaluate AWS_STS_REGIONAL_ENDPOINTS settings

0 commit comments

Comments
 (0)