taolib.testing.file_storage.cdn.cloudfront#

AWS CloudFront CDN 提供商实现。

提供 CloudFront URL 生成和缓存刷新功能。

Classes#

CloudFrontCDNProvider

AWS CloudFront CDN 提供商。

Module Contents#

class taolib.testing.file_storage.cdn.cloudfront.CloudFrontCDNProvider(distribution_domain: str, key_pair_id: str = '', private_key: str = '')#

AWS CloudFront CDN 提供商。

_domain#
_key_pair_id = ''#
_private_key = ''#
generate_url(bucket: str, key: str) str#

生成 CloudFront 访问 URL。

sign_url(url: str, expires_in: int = 3600) str#

生成 CloudFront 签名 URL。

注意:完整的 CloudFront 签名需要 RSA 私钥。 此处提供 HMAC 简化签名方案。

async invalidate_paths(paths: list[str]) None#

CloudFront 缓存刷新。

注意:完整实现需要 boto3 调用 create_invalidation API。 此处为占位实现。

async invalidate_all() None#

CloudFront 全量缓存刷新。