moto/moto/s3/urls.py

20 lines
687 B
Python
Raw Normal View History

from __future__ import unicode_literals
from .responses import S3ResponseInstance
2013-03-05 08:14:43 -05:00
url_bases = [
2015-11-27 13:49:44 -05:00
"https?://s3(.*).amazonaws.com",
2019-10-31 08:44:26 -07:00
r"https?://(?P<bucket_name>[a-zA-Z0-9\-_.]*)\.?s3(.*).amazonaws.com",
2013-03-05 08:14:43 -05:00
]
2013-02-18 16:09:40 -05:00
url_paths = {
2015-11-27 13:49:44 -05:00
# subdomain bucket
2019-10-31 08:44:26 -07:00
"{0}/$": S3ResponseInstance.bucket_response,
2015-11-27 13:49:44 -05:00
# subdomain key of path-based bucket
2019-10-31 08:44:26 -07:00
"{0}/(?P<key_or_bucket_name>[^/]+)/?$": S3ResponseInstance.ambiguous_response,
2015-11-27 13:49:44 -05:00
# path-based bucket + key
"{0}/(?P<bucket_name_path>[^/]+)/(?P<key_name>.+)": S3ResponseInstance.key_or_control_response,
# subdomain bucket + key with empty first part of path
"{0}//(?P<key_name>.*)$": S3ResponseInstance.key_or_control_response,
}