diff --git a/.example.env b/.example.env
index 468bff2a..f639ead5 100644
--- a/.example.env
+++ b/.example.env
@@ -33,3 +33,4 @@ CERT_ARN=
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]
diff --git a/.github/workflows/tests/test_stac.py b/.github/workflows/tests/test_stac.py
index 0bdc80d7..35e2eef6 100644
--- a/.github/workflows/tests/test_stac.py
+++ b/.github/workflows/tests/test_stac.py
@@ -2,16 +2,89 @@
import httpx
+seeded_collection = "noaa-emergency-response"
+seeded_id = "20200307aC0853300w361200"
stac_endpoint = "http://0.0.0.0:8081"
+index_endpoint = "index.html"
+docs_endpoint = "docs"
+health_endpoint = "_mgmt/ping"
+search_endpoint = "search"
+collections_endpoint = "collections"
+
+
+def test_stac_health():
+ """test stac health endpoint."""
+
+ assert httpx.get(f"{stac_endpoint}/{health_endpoint}").status_code == 200
+
+
+def test_stac_viewer():
+ """test stac viewer."""
+ resp = httpx.get(f"{stac_endpoint}/{index_endpoint}")
+ assert resp.status_code == 200
+ assert resp.headers.get("x-correlation-id") == "local"
+ assert "
Simple STAC API Viewer" in resp.text
+
+
+def test_stac_docs():
+ """test stac docs."""
+ resp = httpx.get(f"{stac_endpoint}/{docs_endpoint}")
+ assert resp.status_code == 200
+ assert "Swagger UI" in resp.text
+
+
+def test_stac_get_search():
+ """test stac get search."""
+ default_limit_param = "?limit=10"
+ resp = httpx.get(f"{stac_endpoint}/{search_endpoint}{default_limit_param}")
+ assert resp.status_code == 200
+ features = resp.json()["features"]
+ assert len(features) > 0
+ collections = [c["collection"] for c in features]
+ assert seeded_collection in collections
+
+
+def test_stac_post_search():
+ """test stac post search."""
+ request_body = {"collections": [seeded_collection]}
+ resp = httpx.post(f"{stac_endpoint}/{search_endpoint}", json=request_body)
+ assert resp.status_code == 200
+ features = resp.json()["features"]
+ assert len(features) > 0
+ collections = [c["collection"] for c in features]
+ assert seeded_collection in collections
+
+
+def test_stac_get_collections():
+ """test stac get collections"""
+ resp = httpx.get(f"{stac_endpoint}/{collections_endpoint}")
+ assert resp.status_code == 200
+ collections = resp.json()["collections"]
+ assert len(collections) > 0
+ id = [c["id"] for c in collections]
+ assert seeded_collection in id
+
+
+def test_stac_get_collections_by_id():
+ """test stac get collection by id"""
+ resp = httpx.get(f"{stac_endpoint}/{collections_endpoint}/{seeded_collection}")
+ assert resp.status_code == 200
+ collection = resp.json()
+ assert collection["id"] == seeded_collection
+
+
+def test_stac_get_collection_items_by_id():
+ """test stac get items in collection by collection id"""
+ resp = httpx.get(
+ f"{stac_endpoint}/{collections_endpoint}/{seeded_collection}/items"
+ )
+ assert resp.status_code == 200
+ collection = resp.json()
+ assert collection["type"] == "FeatureCollection"
def test_stac_api():
"""test stac."""
- # Ping
- assert httpx.get(f"{stac_endpoint}/_mgmt/ping").status_code == 200
-
- # viewer
- assert httpx.get(f"{stac_endpoint}/index.html").status_code == 200
# Collections
resp = httpx.get(f"{stac_endpoint}/collections")
@@ -19,35 +92,35 @@ def test_stac_api():
collections = resp.json()["collections"]
assert len(collections) > 0
ids = [c["id"] for c in collections]
- assert "noaa-emergency-response" in ids
+ assert seeded_collection in ids
# items
- resp = httpx.get(f"{stac_endpoint}/collections/noaa-emergency-response/items")
+ resp = httpx.get(f"{stac_endpoint}/collections/{seeded_collection}/items")
assert resp.status_code == 200
items = resp.json()["features"]
assert len(items) == 10
# item
resp = httpx.get(
- f"{stac_endpoint}/collections/noaa-emergency-response/items/20200307aC0853300w361200"
+ f"{stac_endpoint}/collections/{seeded_collection}/items/{seeded_id}"
)
assert resp.status_code == 200
item = resp.json()
- assert item["id"] == "20200307aC0853300w361200"
+ assert item["id"] == seeded_id
def test_stac_to_raster():
"""test link to raster api."""
# tilejson
resp = httpx.get(
- f"{stac_endpoint}/collections/noaa-emergency-response/items/20200307aC0853300w361200/tilejson.json",
+ f"{stac_endpoint}/collections/{seeded_collection}/items/{seeded_id}/tilejson.json",
params={"assets": "cog"},
)
assert resp.status_code == 307
# viewer
resp = httpx.get(
- f"{stac_endpoint}/collections/noaa-emergency-response/items/20200307aC0853300w361200/viewer",
+ f"{stac_endpoint}/collections/{seeded_collection}/items/{seeded_id}/viewer",
params={"assets": "cog"},
)
assert resp.status_code == 307
diff --git a/ingest_api/runtime/requirements.txt b/ingest_api/runtime/requirements.txt
index 7a6e3e12..de984f61 100644
--- a/ingest_api/runtime/requirements.txt
+++ b/ingest_api/runtime/requirements.txt
@@ -14,9 +14,6 @@ python-multipart==0.0.7
requests>=2.27.1
s3fs==2023.3.0
stac-pydantic @ git+https://github.com/ividito/stac-pydantic.git@3f4cb381c85749bb4b15d1181179057ec0f51a94
-xarray==2023.1.0
-xstac==1.1.0
-zarr==2.13.6
boto3==1.24.59
aws_xray_sdk>=2.6.0,<3
aws-lambda-powertools>=1.18.0
diff --git a/routes/infrastructure/config.py b/routes/infrastructure/config.py
index ec59d67e..e9d4f435 100755
--- a/routes/infrastructure/config.py
+++ b/routes/infrastructure/config.py
@@ -44,6 +44,10 @@ class vedaRouteSettings(BaseSettings):
description="Certificate’s ARN",
)
+ shared_web_acl_id: Optional[str] = Field(
+ None, description="Shared Web ACL ID ARN for CloudFront Distribution"
+ )
+
class Config:
"""model config"""
diff --git a/routes/infrastructure/construct.py b/routes/infrastructure/construct.py
index 2a1bd5a1..524924e7 100755
--- a/routes/infrastructure/construct.py
+++ b/routes/infrastructure/construct.py
@@ -72,6 +72,7 @@ def __init__(
certificate=domain_cert,
default_root_object="index.html",
enable_logging=True,
+ web_acl_id=veda_route_settings.shared_web_acl_id,
domain_names=[
f"{stage}.{veda_route_settings.domain_hosted_zone_name}"
]