File tree 2 files changed +8
-7
lines changed
localstack-core/localstack/services/apigateway/next_gen 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 10
10
from localstack .http import Response
11
11
from localstack .services .apigateway .models import ApiGatewayStore , apigateway_stores
12
12
from localstack .services .edge import ROUTER
13
+ from localstack .services .stores import AccountRegionBundle
13
14
14
15
from .context import RestApiInvocationContext
15
16
from .gateway import RestApiGateway
@@ -38,12 +39,14 @@ class ApiGatewayEndpoint:
38
39
Gateway to be processed by the handler chain.
39
40
"""
40
41
41
- def __init__ (self , rest_gateway : RestApiGateway = None , store : ApiGatewayStore = None ):
42
+ def __init__ (self , rest_gateway : RestApiGateway = None , store : AccountRegionBundle = None ):
42
43
self .rest_gateway = rest_gateway or RestApiGateway ()
43
44
# we only access CrossAccount attributes in the handler, so we use a global store in default account and region
44
- self ._global_store = (
45
- store or apigateway_stores [DEFAULT_AWS_ACCOUNT_ID ][AWS_REGION_US_EAST_1 ]
46
- )
45
+ self ._store = store or apigateway_stores
46
+
47
+ @property
48
+ def _global_store (self ) -> ApiGatewayStore :
49
+ return self ._store [DEFAULT_AWS_ACCOUNT_ID ][AWS_REGION_US_EAST_1 ]
47
50
48
51
def __call__ (self , request : Request , ** kwargs : Unpack [RouteHostPathParameters ]) -> Response :
49
52
"""
Original file line number Diff line number Diff line change 18
18
TestInvokeMethodRequest ,
19
19
TestInvokeMethodResponse ,
20
20
)
21
- from localstack .constants import AWS_REGION_US_EAST_1 , DEFAULT_AWS_ACCOUNT_ID
22
21
from localstack .services .apigateway .helpers import (
23
22
get_apigateway_store ,
24
23
get_moto_rest_api ,
@@ -47,8 +46,7 @@ def __init__(self, router: ApiGatewayRouter = None):
47
46
# we initialize the route handler with a global store with default account and region, because it only ever
48
47
# access values with CrossAccount attributes
49
48
if not router :
50
- store = apigateway_stores [DEFAULT_AWS_ACCOUNT_ID ][AWS_REGION_US_EAST_1 ]
51
- route_handler = ApiGatewayEndpoint (store = store )
49
+ route_handler = ApiGatewayEndpoint (store = apigateway_stores )
52
50
router = ApiGatewayRouter (ROUTER , handler = route_handler )
53
51
54
52
super ().__init__ (router = router )
You can’t perform that action at this time.
0 commit comments