Skip to content

Commit

Permalink
Merge branch 'release-1.35.42'
Browse files Browse the repository at this point in the history
* release-1.35.42:
  Bumping version to 1.35.42
  Update to latest models
  Merge customizations for S3
  Sigv4a signing region set config bugfix (#3279)
  • Loading branch information
aws-sdk-python-automation committed Oct 16, 2024
2 parents 60a882d + f08e038 commit 194b6c3
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 33 deletions.
12 changes: 12 additions & 0 deletions .changes/1.35.42.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"category": "``s3``",
"description": "Add support for the new optional bucket-region and prefix query parameters in the ListBuckets API. For ListBuckets requests that express pagination, Amazon S3 will now return both the bucket names and associated AWS regions in the response.",
"type": "api-change"
},
{
"category": "Config",
"description": "Fixed sigv4a_signing_region_set resolution when set in environment or config file.",
"type": "bugfix"
}
]
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
CHANGELOG
=========

1.35.42
=======

* api-change:``s3``: Add support for the new optional bucket-region and prefix query parameters in the ListBuckets API. For ListBuckets requests that express pagination, Amazon S3 will now return both the bucket names and associated AWS regions in the response.
* bugfix:Config: Fixed sigv4a_signing_region_set resolution when set in environment or config file.


1.35.41
=======

Expand Down
2 changes: 1 addition & 1 deletion botocore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import re

__version__ = '1.35.41'
__version__ = '1.35.42'


class NullHandler(logging.Handler):
Expand Down
11 changes: 11 additions & 0 deletions botocore/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def compute_client_args(
self._compute_connect_timeout(config_kwargs)
self._compute_user_agent_appid_config(config_kwargs)
self._compute_request_compression_config(config_kwargs)
self._compute_sigv4a_signing_region_set_config(config_kwargs)
s3_config = self.compute_s3_config(client_config)

is_s3_service = self._is_s3_service(service_name)
Expand Down Expand Up @@ -771,3 +772,13 @@ def _compute_user_agent_appid_config(self, config_kwargs):
f'maximum length of {USERAGENT_APPID_MAXLEN} characters.'
)
config_kwargs['user_agent_appid'] = user_agent_appid

def _compute_sigv4a_signing_region_set_config(self, config_kwargs):
sigv4a_signing_region_set = config_kwargs.get(
'sigv4a_signing_region_set'
)
if sigv4a_signing_region_set is None:
sigv4a_signing_region_set = self._config_store.get_config_variable(
'sigv4a_signing_region_set'
)
config_kwargs['sigv4a_signing_region_set'] = sigv4a_signing_region_set
15 changes: 10 additions & 5 deletions botocore/data/s3/2006-03-01/paginators-1.sdk-extras.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,32 @@
"pagination": {
"ListBuckets": {
"non_aggregate_keys": [
"Owner"
"Owner",
"Prefix"
]
},
"ListMultipartUploads": {
"non_aggregate_keys": [
"RequestCharged"
"RequestCharged",
"Prefix"
]
},
"ListObjectVersions": {
"non_aggregate_keys": [
"RequestCharged"
"RequestCharged",
"Prefix"
]
},
"ListObjects": {
"non_aggregate_keys": [
"RequestCharged"
"RequestCharged",
"Prefix"
]
},
"ListObjectsV2": {
"non_aggregate_keys": [
"RequestCharged"
"RequestCharged",
"Prefix"
]
},
"ListParts": {
Expand Down
59 changes: 40 additions & 19 deletions botocore/data/s3/2006-03-01/service-2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
# The short X.Y version.
version = '1.35.'
# The full version, including alpha/beta/rc tags.
release = '1.35.41'
release = '1.35.42'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
52 changes: 49 additions & 3 deletions tests/functional/test_auth_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# language governing permissions and limitations under the License.
import pytest

from botocore.session import get_session
from botocore.config import Config
from tests import create_session, mock

# In the future, a service may have a list of credentials requirements where one
# signature may fail and others may succeed. e.g. a service may want to use bearer
Expand All @@ -31,7 +32,7 @@


def _all_test_cases():
session = get_session()
session = create_session()
loader = session.get_component('data_loader')

services = loader.list_available_services('service-2')
Expand Down Expand Up @@ -74,4 +75,49 @@ def assert_all_requirements_match(auth_config, message):
auth_requirements = set(
AUTH_TYPE_REQUIREMENTS[auth_type] for auth_type in auth_config
)
assert len(auth_requirements) == 1
assert len(auth_requirements) == 1, message


def get_config_file_path(base_path, value):
if value is None:
return "file-does-not-exist"

tmp_config_file_path = base_path / "config"
tmp_config_file_path.write_text(
f"[default]\nsigv4a_signing_region_set={value}\n"
)
return tmp_config_file_path


def get_environ_mock(
request,
env_var_value=None,
config_file_value=None,
):
base_path = request.getfixturevalue("tmp_path")
config_file_path = get_config_file_path(base_path, config_file_value)
return {
"AWS_CONFIG_FILE": str(config_file_path),
"AWS_SIGV4A_SIGNING_REGION_SET": env_var_value,
}


@pytest.mark.parametrize(
"client_config, env_var_val, config_file_val, expected",
[
(Config(sigv4a_signing_region_set="foo"), "bar", "baz", "foo"),
(Config(sigv4a_signing_region_set="foo"), None, None, "foo"),
(None, "bar", "baz", "bar"),
(None, None, "baz", "baz"),
(Config(sigv4a_signing_region_set="foo"), None, "baz", "foo"),
(None, None, None, None),
],
)
def test_sigv4a_signing_region_set_config_from_environment(
client_config, env_var_val, config_file_val, expected, request
):
environ_mock = get_environ_mock(request, env_var_val, config_file_val)
with mock.patch('os.environ', environ_mock):
session = create_session()
s3 = session.create_client('s3', config=client_config)
assert s3.meta.config.sigv4a_signing_region_set == expected
4 changes: 0 additions & 4 deletions tests/functional/test_paginator_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
'route53.ListResourceRecordSets.MaxItems',
's3.ListMultipartUploads.Delimiter',
's3.ListMultipartUploads.KeyMarker',
's3.ListMultipartUploads.Prefix',
's3.ListMultipartUploads.Bucket',
's3.ListMultipartUploads.MaxUploads',
's3.ListMultipartUploads.UploadIdMarker',
Expand All @@ -90,13 +89,11 @@
's3.ListObjectVersions.Delimiter',
's3.ListObjectVersions.VersionIdMarker',
's3.ListObjectVersions.KeyMarker',
's3.ListObjectVersions.Prefix',
's3.ListObjectVersions.Name',
's3.ListObjectVersions.EncodingType',
's3.ListObjects.MaxKeys',
's3.ListObjects.Delimiter',
's3.ListObjects.NextMarker',
's3.ListObjects.Prefix',
's3.ListObjects.Marker',
's3.ListObjects.Name',
's3.ListObjects.EncodingType',
Expand All @@ -105,7 +102,6 @@
's3.ListObjectsV2.Delimiter',
's3.ListObjectsV2.ContinuationToken',
's3.ListObjectsV2.KeyCount',
's3.ListObjectsV2.Prefix',
's3.ListObjectsV2.Name',
's3.ListObjectsV2.EncodingType',
's3.ListParts.PartNumberMarker',
Expand Down

0 comments on commit 194b6c3

Please sign in to comment.