diff --git a/.example.env b/.example.env index c3fb4b62..984a692e 100644 --- a/.example.env +++ b/.example.env @@ -40,3 +40,4 @@ VEDA_CLOUDFRONT= VEDA_CLOUDFRONT_OAC=[OPTIONAL, CONFIGURES ORIGIN ACCESS CONTROL, DEFAULTS TO TRUE] VEDA_CUSTOM_HOST= VEDA_SHARED_WEB_ACL_ID=[OPTIONAL ID ARN for WEB ACL] +VEDA_DISABLE_DEFAULT_APIGW_ENDPOINT=[OPTIONAL BOOL TO DISABLE DEFAULT API GATEWAY ENDPOINTS] diff --git a/config.py b/config.py index c792b1b7..93bb6d8c 100644 --- a/config.py +++ b/config.py @@ -109,6 +109,11 @@ class vedaAppSettings(BaseSettings): None, description="Custom domain name, i.e. veda-backend.xyz" ) + disable_default_apigw_endpoint: Optional[bool] = Field( + False, + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false.", + ) + def cdk_env(self) -> dict: """Load a cdk environment dict for stack""" diff --git a/ingest_api/infrastructure/config.py b/ingest_api/infrastructure/config.py index 31a894bb..a4ca9d37 100644 --- a/ingest_api/infrastructure/config.py +++ b/ingest_api/infrastructure/config.py @@ -88,6 +88,11 @@ class IngestorConfig(BaseSettings): description="Raster API root path. Used to infer url of raster-api before app synthesis.", ) + disable_default_apigw_endpoint: Optional[bool] = Field( + False, + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false.", + ) + class Config: case_sensitive = False env_file = ".env" diff --git a/ingest_api/infrastructure/construct.py b/ingest_api/infrastructure/construct.py index d7dcd05f..5f298b86 100644 --- a/ingest_api/infrastructure/construct.py +++ b/ingest_api/infrastructure/construct.py @@ -91,6 +91,7 @@ def __init__( construct_id=construct_id, handler=self.api_lambda, custom_host=config.custom_host, + disable_default_apigw_endpoint=config.disable_default_apigw_endpoint, ) stack_name = Stack.of(self).stack_name @@ -188,6 +189,7 @@ def build_api( construct_id: str, handler: aws_lambda.IFunction, custom_host: Optional[str], + disable_default_apigw_endpoint: Optional[bool], ) -> aws_apigatewayv2_alpha.HttpApi: integration_kwargs = dict(handler=handler) if custom_host: @@ -211,6 +213,7 @@ def build_api( self, f"{stack_name}-{construct_id}", default_integration=ingest_api_integration, + disable_execute_api_endpoint=disable_default_apigw_endpoint, ) def build_jwks_url(self, userpool_id: str) -> str: diff --git a/raster_api/infrastructure/config.py b/raster_api/infrastructure/config.py index f3474226..f5e5a055 100644 --- a/raster_api/infrastructure/config.py +++ b/raster_api/infrastructure/config.py @@ -84,6 +84,10 @@ class vedaRasterSettings(BaseSettings): "VEDA (Visualization, Exploration, and Data Analysis)", description="Name of the STAC Catalog", ) + disable_default_apigw_endpoint: Optional[bool] = Field( + False, + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false.", + ) class Config: """model config""" diff --git a/raster_api/infrastructure/construct.py b/raster_api/infrastructure/construct.py index b75a9f21..389e29f5 100644 --- a/raster_api/infrastructure/construct.py +++ b/raster_api/infrastructure/construct.py @@ -99,6 +99,7 @@ def __init__( self, f"{stack_name}-{construct_id}", default_integration=raster_api_integration, + disable_execute_api_endpoint=veda_raster_settings.disable_default_apigw_endpoint, ) CfnOutput( diff --git a/stac_api/infrastructure/config.py b/stac_api/infrastructure/config.py index 2196a430..bba00ea4 100644 --- a/stac_api/infrastructure/config.py +++ b/stac_api/infrastructure/config.py @@ -57,6 +57,10 @@ class vedaSTACSettings(BaseSettings): stac_enable_transactions: bool = Field( False, description="Whether to enable transactions endpoints" ) + disable_default_apigw_endpoint: Optional[bool] = Field( + False, + description="Boolean to disable default API gateway endpoints for stac, raster, and ingest APIs. Defaults to false.", + ) @root_validator def check_transaction_fields(cls, values): diff --git a/stac_api/infrastructure/construct.py b/stac_api/infrastructure/construct.py index c3ca56a0..10b4879b 100644 --- a/stac_api/infrastructure/construct.py +++ b/stac_api/infrastructure/construct.py @@ -106,6 +106,7 @@ def __init__( self, f"{stack_name}-{construct_id}", default_integration=stac_api_integration, + disable_execute_api_endpoint=veda_stac_settings.disable_default_apigw_endpoint, ) CfnOutput(