Skip to content

Commit c446a3e

Browse files
bentskudominikschubert
authored andcommitted
make next-gen APIGW provider default (#11035)
1 parent f7037ee commit c446a3e

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

localstack-core/localstack/config.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,16 +1129,8 @@ def populate_edge_configuration(
11291129
# Whether to really publish to GCM while using SNS Platform Application (needs credentials)
11301130
LEGACY_SNS_GCM_PUBLISHING = is_env_true("LEGACY_SNS_GCM_PUBLISHING")
11311131

1132-
# Whether the Next Gen APIGW invocation logic is enabled (handler chain)
1133-
APIGW_NEXT_GEN_PROVIDER = os.environ.get("PROVIDER_OVERRIDE_APIGATEWAY", "") == "next_gen"
1134-
if APIGW_NEXT_GEN_PROVIDER:
1135-
# in order to not have conflicts with different implementation registering their own router, we need to have all of
1136-
# them use the same new implementation
1137-
if not os.environ.get("PROVIDER_OVERRIDE_APIGATEWAYV2"):
1138-
os.environ["PROVIDER_OVERRIDE_APIGATEWAYV2"] = "next_gen"
1139-
1140-
if not os.environ.get("PROVIDER_OVERRIDE_APIGATEWAYMANAGEMENTAPI"):
1141-
os.environ["PROVIDER_OVERRIDE_APIGATEWAYMANAGEMENTAPI"] = "next_gen"
1132+
# Whether the Next Gen APIGW invocation logic is enabled (on by default)
1133+
APIGW_NEXT_GEN_PROVIDER = os.environ.get("PROVIDER_OVERRIDE_APIGATEWAY", "") in ("next_gen", "")
11421134

11431135
# Whether the DynamoDBStreams native provider is enabled
11441136
DDB_STREAMS_PROVIDER_V2 = os.environ.get("PROVIDER_OVERRIDE_DYNAMODBSTREAMS", "") == "v2"
@@ -1152,7 +1144,6 @@ def populate_edge_configuration(
11521144
os.environ["PROVIDER_OVERRIDE_DYNAMODBSTREAMS"] = "v2"
11531145
DDB_STREAMS_PROVIDER_V2 = True
11541146

1155-
11561147
# TODO remove fallback to LAMBDA_DOCKER_NETWORK with next minor version
11571148
MAIN_DOCKER_NETWORK = os.environ.get("MAIN_DOCKER_NETWORK", "") or LAMBDA_DOCKER_NETWORK
11581149

localstack-core/localstack/services/providers.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ def acm():
1414
return Service.for_provider(provider, dispatch_table_factory=MotoFallbackDispatcher)
1515

1616

17-
@aws_provider(api="apigateway")
17+
@aws_provider()
1818
def apigateway():
19-
from localstack.services.apigateway.legacy.provider import ApigatewayProvider
19+
from localstack.services.apigateway.next_gen.provider import ApigatewayNextGenProvider
2020
from localstack.services.moto import MotoFallbackDispatcher
2121

22-
provider = ApigatewayProvider()
22+
provider = ApigatewayNextGenProvider()
2323
return Service.for_provider(provider, dispatch_table_factory=MotoFallbackDispatcher)
2424

2525

@@ -32,6 +32,15 @@ def apigateway_next_gen():
3232
return Service.for_provider(provider, dispatch_table_factory=MotoFallbackDispatcher)
3333

3434

35+
@aws_provider(api="apigateway", name="legacy")
36+
def apigateway_legacy():
37+
from localstack.services.apigateway.legacy.provider import ApigatewayProvider
38+
from localstack.services.moto import MotoFallbackDispatcher
39+
40+
provider = ApigatewayProvider()
41+
return Service.for_provider(provider, dispatch_table_factory=MotoFallbackDispatcher)
42+
43+
3544
@aws_provider()
3645
def cloudformation():
3746
from localstack.services.cloudformation.provider import CloudformationProvider

0 commit comments

Comments
 (0)