Skip to content

Commit

Permalink
Added aws_endpoint_url cli option
Browse files Browse the repository at this point in the history
  • Loading branch information
fewstera committed Jul 15, 2019
1 parent 401870b commit c3bf81e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions awslogs/bin.py
Expand Up @@ -55,6 +55,12 @@ def add_common_arguments(parser):
default=os.environ.get('AWS_REGION', None),
help="aws region")

parser.add_argument("--aws-endpoint-url",
dest="aws_endpoint_url",
type=str,
default=None,
help="aws endpoint url")

def add_date_range_arguments(parser, default_start='5m'):
parser.add_argument("-s", "--start",
type=str,
Expand Down
9 changes: 6 additions & 3 deletions awslogs/core.py
Expand Up @@ -31,7 +31,7 @@ def milis2iso(milis):
return (res + ".000")[:23] + 'Z'


def boto3_client(aws_profile, aws_access_key_id, aws_secret_access_key, aws_session_token, aws_region):
def boto3_client(aws_profile, aws_access_key_id, aws_secret_access_key, aws_session_token, aws_region, aws_endpoint_url):
core_session = botocore.session.get_session()
core_session.set_config_variable('profile', aws_profile)

Expand All @@ -45,7 +45,8 @@ def boto3_client(aws_profile, aws_access_key_id, aws_secret_access_key, aws_sess
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
aws_session_token=aws_session_token,
region_name=aws_region)
region_name=aws_region,
endpoint_url=aws_endpoint_url)


class AWSLogs(object):
Expand All @@ -61,6 +62,7 @@ class AWSLogs(object):
def __init__(self, **kwargs):
self.aws_region = kwargs.get('aws_region')
self.aws_access_key_id = kwargs.get('aws_access_key_id')
self.aws_endpoint_url = kwargs.get('aws_endpoint_url')
self.aws_secret_access_key = kwargs.get('aws_secret_access_key')
self.aws_session_token = kwargs.get('aws_session_token')
self.aws_profile = kwargs.get('aws_profile')
Expand All @@ -86,7 +88,8 @@ def __init__(self, **kwargs):
self.aws_access_key_id,
self.aws_secret_access_key,
self.aws_session_token,
self.aws_region
self.aws_region,
self.aws_endpoint_url
)

def _get_streams_from_pattern(self, group, pattern):
Expand Down

0 comments on commit c3bf81e

Please sign in to comment.