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

Commit d46f42f

Browse files
committed
allow specifying an endpoint_url override
1 parent 0ca4d12 commit d46f42f

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Diff for: confidant_client/__init__.py

+10-4
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.')

Diff for: confidant_client/cli.py

+6-1
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

@@ -131,6 +132,10 @@ def _parse_args():
131132
'--region',
132133
help='Use the specified region for authentication.'
133134
)
135+
parser.add_argument(
136+
'--kms-endpoint-url',
137+
help='Use a different endpoint url for the KMS service.'
138+
)
134139
parser.add_argument(
135140
'--log-level',
136141
help='Logging verbosity.',

0 commit comments

Comments
 (0)