Add multi-region support to EC2 Instances
This commit is contained in:
parent
348d1803ed
commit
82eef28937
8 changed files with 92 additions and 24 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import datetime
|
||||
import json
|
||||
import re
|
||||
|
||||
from urlparse import parse_qs, urlparse
|
||||
|
||||
|
|
@ -9,6 +10,8 @@ from moto.core.utils import camelcase_to_underscores, method_names_from_class
|
|||
|
||||
class BaseResponse(object):
|
||||
|
||||
region = 'us-east-1'
|
||||
|
||||
def dispatch(self, request, full_url, headers):
|
||||
querystring = {}
|
||||
|
||||
|
|
@ -38,6 +41,9 @@ class BaseResponse(object):
|
|||
self.path = urlparse(full_url).path
|
||||
self.querystring = querystring
|
||||
self.method = request.method
|
||||
region = re.search(r'\.(.+?)\.amazonaws\.com', full_url)
|
||||
if region:
|
||||
self.region = region.group(1)
|
||||
|
||||
self.headers = dict(request.headers)
|
||||
self.response_headers = headers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue