Skip to content

Commit

Permalink
Merge branch 'release-1.31.0'
Browse files Browse the repository at this point in the history
* release-1.31.0:
  Bumping version to 1.31.0
  Update to latest partitions and endpoints
  Update to latest models
  Fix test for memory issues on Windows GH Actions
  Add client config ignore endpoint tests
  Remove repr for the configured endpoint provider
  Set transformed service ID at init
  Add debug log when ignoring configured endpoint
  Add functional tests for configured endpoint url resolution
  Implement configured endpoint URL resolution
  Shallow copy config value store and providers
  Fix bug with config value store deep copy
  Add non_aggregate_keys for GetOutpostInstanceTypes API
  • Loading branch information
aws-sdk-python-automation committed Jul 6, 2023
2 parents ee7333e + 86c506a commit 1bd7445
Show file tree
Hide file tree
Showing 31 changed files with 2,259 additions and 516 deletions.
42 changes: 42 additions & 0 deletions .changes/1.31.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"category": "``ec2``",
"description": "Add Nitro Enclaves support on DescribeInstanceTypes",
"type": "api-change"
},
{
"category": "``location``",
"description": "This release adds support for authenticating with Amazon Location Service's Places & Routes APIs with an API Key. Also, with this release developers can publish tracked device position updates to Amazon EventBridge.",
"type": "api-change"
},
{
"category": "``outposts``",
"description": "Added paginator support to several APIs. Added the ISOLATED enum value to AssetState.",
"type": "api-change"
},
{
"category": "``quicksight``",
"description": "This release includes below three changes: small multiples axes improvement, field based coloring, removed required trait from Aggregation function for TopBottomFilter.",
"type": "api-change"
},
{
"category": "``rds``",
"description": "Updates Amazon RDS documentation for creating DB instances and creating Aurora global clusters.",
"type": "api-change"
},
{
"category": "configprovider",
"description": "Fix bug when deep copying config value store where overrides were not preserved",
"type": "bugfix"
},
{
"category": "configprovider",
"description": "Always use shallow copy of session config value store for clients",
"type": "enhancement"
},
{
"category": "configuration",
"description": "Configure the endpoint URL in the shared configuration file or via an environment variable for a specific AWS service or all AWS services.",
"type": "feature"
}
]
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
CHANGELOG
=========

1.31.0
======

* api-change:``ec2``: Add Nitro Enclaves support on DescribeInstanceTypes
* api-change:``location``: This release adds support for authenticating with Amazon Location Service's Places & Routes APIs with an API Key. Also, with this release developers can publish tracked device position updates to Amazon EventBridge.
* api-change:``outposts``: Added paginator support to several APIs. Added the ISOLATED enum value to AssetState.
* api-change:``quicksight``: This release includes below three changes: small multiples axes improvement, field based coloring, removed required trait from Aggregation function for TopBottomFilter.
* api-change:``rds``: Updates Amazon RDS documentation for creating DB instances and creating Aurora global clusters.
* bugfix:configprovider: Fix bug when deep copying config value store where overrides were not preserved
* enhancement:configprovider: Always use shallow copy of session config value store for clients
* feature:configuration: Configure the endpoint URL in the shared configuration file or via an environment variable for a specific AWS service or all AWS services.


1.30.1
======

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.30.1'
__version__ = '1.31.0'


class NullHandler(logging.Handler):
Expand Down
34 changes: 31 additions & 3 deletions botocore/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def get_client_args(
s3_config = final_args['s3_config']
partition = endpoint_config['metadata'].get('partition', None)
socket_options = final_args['socket_options']

configured_endpoint_url = final_args['configured_endpoint_url']
signing_region = endpoint_config['signing_region']
endpoint_region_name = endpoint_config['region_name']

Expand Down Expand Up @@ -160,7 +160,7 @@ def get_client_args(
service_model,
endpoint_region_name,
region_name,
endpoint_url,
configured_endpoint_url,
endpoint,
is_secure,
endpoint_bridge,
Expand Down Expand Up @@ -210,10 +210,16 @@ def compute_client_args(
parameter_validation = ensure_boolean(raw_value)

s3_config = self.compute_s3_config(client_config)

configured_endpoint_url = self._compute_configured_endpoint_url(
client_config=client_config,
endpoint_url=endpoint_url,
)

endpoint_config = self._compute_endpoint_config(
service_name=service_name,
region_name=region_name,
endpoint_url=endpoint_url,
endpoint_url=configured_endpoint_url,
is_secure=is_secure,
endpoint_bridge=endpoint_bridge,
s3_config=s3_config,
Expand Down Expand Up @@ -270,6 +276,7 @@ def compute_client_args(
return {
'service_name': service_name,
'parameter_validation': parameter_validation,
'configured_endpoint_url': configured_endpoint_url,
'endpoint_config': endpoint_config,
'protocol': protocol,
'config_kwargs': config_kwargs,
Expand All @@ -279,6 +286,27 @@ def compute_client_args(
),
}

def _compute_configured_endpoint_url(self, client_config, endpoint_url):
if endpoint_url is not None:
return endpoint_url

if self._ignore_configured_endpoint_urls(client_config):
logger.debug("Ignoring configured endpoint URLs.")
return endpoint_url

return self._config_store.get_config_variable('endpoint_url')

def _ignore_configured_endpoint_urls(self, client_config):
if (
client_config
and client_config.ignore_configured_endpoint_urls is not None
):
return client_config.ignore_configured_endpoint_urls

return self._config_store.get_config_variable(
'ignore_configured_endpoint_urls'
)

def compute_s3_config(self, client_config):
s3_configuration = self._config_store.get_config_variable('s3')

Expand Down
8 changes: 8 additions & 0 deletions botocore/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ class Config:
Defaults to None.
:type ignore_configured_endpoint_urls: bool
:param ignore_configured_endpoint_urls: Setting to True disables use
of endpoint URLs provided via environment variables and
the shared configuration file.
Defaults to None.
:type tcp_keepalive: bool
:param tcp_keepalive: Enables the TCP Keep-Alive socket option used when
creating new connections if set to True.
Expand Down Expand Up @@ -221,6 +228,7 @@ class Config:
('endpoint_discovery_enabled', None),
('use_dualstack_endpoint', None),
('use_fips_endpoint', None),
('ignore_configured_endpoint_urls', None),
('defaults_mode', None),
('tcp_keepalive', None),
]
Expand Down
29 changes: 17 additions & 12 deletions botocore/configloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ def _parse_nested(config_value):
return parsed


def _parse_section(key, values):
result = {}
try:
parts = shlex.split(key)
except ValueError:
return result
if len(parts) == 2:
result[parts[1]] = values
return result


def build_profile_map(parsed_ini_config):
"""Convert the parsed INI config into a profile map.
Expand Down Expand Up @@ -254,22 +265,15 @@ def build_profile_map(parsed_ini_config):
parsed_config = copy.deepcopy(parsed_ini_config)
profiles = {}
sso_sessions = {}
services = {}
final_config = {}
for key, values in parsed_config.items():
if key.startswith("profile"):
try:
parts = shlex.split(key)
except ValueError:
continue
if len(parts) == 2:
profiles[parts[1]] = values
profiles.update(_parse_section(key, values))
elif key.startswith("sso-session"):
try:
parts = shlex.split(key)
except ValueError:
continue
if len(parts) == 2:
sso_sessions[parts[1]] = values
sso_sessions.update(_parse_section(key, values))
elif key.startswith("services"):
services.update(_parse_section(key, values))
elif key == 'default':
# default section is special and is considered a profile
# name but we don't require you use 'profile "default"'
Expand All @@ -279,4 +283,5 @@ def build_profile_map(parsed_ini_config):
final_config[key] = values
final_config['profiles'] = profiles
final_config['sso_sessions'] = sso_sessions
final_config['services'] = services
return final_config
Loading

0 comments on commit 1bd7445

Please sign in to comment.