Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions api/consumer/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,29 @@ paths:
description: |
Read a single document pointer by specifying the `DocumentReference.id`. Note that you will only be able to
retrieve document pointers that have the `type` that was agreed during the [onboarding](#api-description__onboarding) process.

/metadata:
get:
summary: Retrieve FHIR Capability Statement
operationId: getCapabilityStatement
responses:
"200":
description: Capability statement response
content:
application/json:
schema:
type: object
x-amazon-apigateway-integration:
type: MOCK
requestTemplates:
application/json: '{ "statusCode": 200 }'
responses:
default:
statusCode: "200"
responseTemplates:
# prettier-ignore
application/json: '${capability_statement_json}'

/_status:
get:
tags:
Expand Down
23 changes: 23 additions & 0 deletions api/producer/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,29 @@ paths:
contentHandling: CONVERT_TO_TEXT
description: |
Delete a single document pointer that your created.

/metadata:
get:
summary: Retrieve FHIR Capability Statement
operationId: getCapabilityStatement
responses:
"200":
description: Capability statement response
content:
application/json:
schema:
type: object
x-amazon-apigateway-integration:
type: MOCK
requestTemplates:
application/json: '{ "statusCode": 200 }'
responses:
default:
statusCode: "200"
responseTemplates:
# prettier-ignore
application/json: '${capability_statement_json}'

/_status:
get:
summary: _status endpoint for APIGEE integration
Expand Down
2 changes: 1 addition & 1 deletion terraform/infrastructure/consumer.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
}
],
"versioning": "version",
"readHistory": false,
"readHistory": false
},
{
"type": "DocumentReference",
Expand Down
55 changes: 6 additions & 49 deletions terraform/infrastructure/modules/api_gateway/api_gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,12 @@ resource "aws_api_gateway_rest_api" "api_gateway_rest_api" {
name = "${var.prefix}--${var.apitype}"
description = "Manages an API Gateway Rest API."
disable_execute_api_endpoint = true
body = templatefile("${path.module}/../../../../api/${var.apitype}/swagger.yaml", var.lambdas)
}

resource "aws_api_gateway_resource" "capability" {
rest_api_id = aws_api_gateway_rest_api.api_gateway_rest_api.id
parent_id = aws_api_gateway_rest_api.api_gateway_rest_api.root_resource_id
path_part = "metadata"
}

resource "aws_api_gateway_method" "capability" {
rest_api_id = aws_api_gateway_rest_api.api_gateway_rest_api.id
resource_id = aws_api_gateway_resource.capability.id
http_method = "GET"
authorization = "NONE"

depends_on = [aws_api_gateway_resource.capability]
}

resource "aws_api_gateway_integration" "capability" {
rest_api_id = aws_api_gateway_rest_api.api_gateway_rest_api.id
resource_id = aws_api_gateway_resource.capability.id
http_method = aws_api_gateway_method.capability.http_method
type = "MOCK"
request_templates = {
"application/json" = jsonencode({ "statusCode" = 200 })
}
}

resource "aws_api_gateway_method_response" "capability_200" {
rest_api_id = aws_api_gateway_rest_api.api_gateway_rest_api.id
resource_id = aws_api_gateway_resource.capability.id
http_method = aws_api_gateway_method.capability.http_method
status_code = "200"
}

resource "aws_api_gateway_integration_response" "capability" {
rest_api_id = aws_api_gateway_rest_api.api_gateway_rest_api.id
resource_id = aws_api_gateway_resource.capability.id
http_method = aws_api_gateway_method.capability.http_method
status_code = aws_api_gateway_method_response.capability_200.status_code

response_templates = {
"application/json" = var.capability_statement_content
}
body = templatefile(
"${path.module}/../../../../api/${var.apitype}/swagger.yaml",
merge(var.lambdas, {
capability_statement_json = var.capability_statement_content
})
)
}

resource "aws_api_gateway_deployment" "api_gateway_deployment" {
Expand All @@ -65,11 +27,6 @@ resource "aws_api_gateway_deployment" "api_gateway_deployment" {

depends_on = [
aws_api_gateway_rest_api.api_gateway_rest_api,
aws_api_gateway_resource.capability,
aws_api_gateway_method.capability,
aws_api_gateway_integration.capability,
aws_api_gateway_method_response.capability_200,
aws_api_gateway_integration_response.capability,
aws_api_gateway_integration_response.head_integration_response
]
}
Expand Down
5 changes: 3 additions & 2 deletions terraform/infrastructure/producer.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"description": "Capability Statement for the National Record Locator FHIR R4 Producer API",
"kind": "instance",
"software": {
"name": "National Record Locator FHIR R4 API - Producer"
"name": "National Record Locator FHIR R4 API - Producer",
"version": "v3.0"
},
"implementation": {
"description": "NRL v3.0 Producer API FHIR Server",
Expand Down Expand Up @@ -57,7 +58,7 @@
}
],
"versioning": "version",
"readHistory": false,
"readHistory": false
},
{
"type": "DocumentReference",
Expand Down
11 changes: 0 additions & 11 deletions tests/smoke/scenarios/api_capability_statement_lookup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import os

import pytest

from tests.utilities.api_clients import ConsumerTestClient, ProducerTestClient


def is_public_url():
return os.environ.get("TEST_CONNECT_MODE") == "public"


@pytest.mark.skip(
reason="Capability statements only work via APIGEE in persistent environments",
)
def test_read_api_capability_statements(
consumer_client: ConsumerTestClient, producer_client: ProducerTestClient
):
Expand Down