Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 3c25703

Browse files
committed
allow specifying an endpoint_url override
1 parent 03ca865 commit 3c25703

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

confidant_client/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def __init__(
5050
retries=None,
5151
backoff=None,
5252
config_files=None,
53-
profile=None
53+
profile=None,
54+
kms_endpoint_url=None
5455
):
5556
"""Create a ConfidantClient object.
5657
@@ -78,6 +79,8 @@ def __init__(
7879
configuration from. First file found will be used. Default:
7980
['~/.confidant', '/etc/confidant/config']
8081
profile: profile to read config values from.
82+
kms_endpoint_url: A URL to override the default endpoint used to
83+
access the KMS service. Default: None
8184
"""
8285
# Set defaults
8386
self.config = {
@@ -90,7 +93,8 @@ def __init__(
9093
'assume_role': None,
9194
'region': None,
9295
'retries': 0,
93-
'backoff': 1
96+
'backoff': 1,
97+
'kms_endpoint_url': None
9498
}
9599
if config_files is None:
96100
config_files = ['~/.confidant', '/etc/confidant/config']
@@ -108,7 +112,8 @@ def __init__(
108112
'token_cache_file': token_cache_file,
109113
'region': region,
110114
'backoff': backoff,
111-
'assume_role': assume_role
115+
'assume_role': assume_role,
116+
'kms_endpoint_url': kms_endpoint_url
112117
}
113118
for key, val in args_config.iteritems():
114119
if val is not None:
@@ -157,7 +162,8 @@ def __init__(
157162
token_version=self.config['token_version'],
158163
token_cache_file=self.config['token_cache_file'],
159164
token_lifetime=self.config['token_lifetime'],
160-
aws_creds=self.aws_creds
165+
aws_creds=self.aws_creds,
166+
endpoint_url=self.config['kms_endpoint_url']
161167
)
162168
except kmsauth.ConfigurationError:
163169
raise ClientConfigurationError('Error configuring kmsauth client.')

confidant_client/cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def _get_client_from_args(args):
4343
region=args.region,
4444
retries=args.retries,
4545
config_files=config_files,
46-
profile=args.profile
46+
profile=args.profile,
47+
kms_endpoint_url=args.kms_endpoint_url
4748
)
4849
return client
4950

@@ -133,6 +134,10 @@ def _parse_args():
133134
'--region',
134135
help='Use the specified region for authentication.'
135136
)
137+
parser.add_argument(
138+
'--kms-endpoint-url',
139+
help='Use a different endpoint url for the KMS service.'
140+
)
136141
parser.add_argument(
137142
'--log-level',
138143
help='Logging verbosity.',

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
# Licence: Apache2
4646
# Upstream url: https://github.com/lyft/python-kmsauth
4747
# Use: client authentication to confidant
48-
'kmsauth>=0.1.6,<1.0.0',
48+
'kmsauth>=0.2.0,<1.0.0',
4949

5050
# Provides enhanced HTTPS support for httplib and urllib2 using PyOpenSSL
5151
# License: BSD

0 commit comments

Comments
 (0)