# Copyright (c) 2017 CloudZero - ALL RIGHTS RESERVED - PROPRIETARY AND CONFIDENTIAL
# Unauthorized copying of this file and/or project, via any medium is strictly prohibited.
# Direct all questions to legal@cloudzero.com
import boto3

s3_client = boto3.client('s3')

DEFAULT_URL_EXPIRATION = 900


def get_presigned_url(bucket: str, key: str, expires_in: int = DEFAULT_URL_EXPIRATION) -> str:
    return s3_client.generate_presigned_url(
        'get_object',
        Params={
            'Bucket': bucket,
            'Key': key,
        },
        ExpiresIn=expires_in,
        HttpMethod='GET',
    )
