-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exposing service provider openapi + mock
- Loading branch information
1 parent
8faa806
commit 269855a
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
## RTP Service Provider API ## | ||
resource "azurerm_api_management_api_version_set" "rtp_service_provider_api" { | ||
name = "${var.env_short}-rtp-service-provider-api" | ||
api_management_name = data.azurerm_api_management.this.name | ||
resource_group_name = data.azurerm_api_management.this.resource_group_name | ||
|
||
display_name = "RTP Service Provider API" | ||
versioning_scheme = "Segment" | ||
} | ||
|
||
resource "azurerm_api_management_api" "rtp_service_provider_api" { | ||
name = "${var.env_short}-rtp-service-provider-api" | ||
api_management_name = data.azurerm_api_management.this.name | ||
resource_group_name = data.azurerm_api_management.this.resource_group_name | ||
|
||
version_set_id = azurerm_api_management_api_version_set.rtp_service_provider_api.id | ||
|
||
revision = "1" | ||
version = "v1" | ||
description = "RTP Service Provider API" | ||
display_name = "RTP Service Provider API" | ||
path = "rtp" | ||
protocols = ["https"] | ||
subscription_required = false | ||
|
||
depends_on = [azurerm_api_management_product.rtp] | ||
|
||
import { | ||
content_format = "openapi" | ||
content_value = templatefile("./api/pagopa/openapi.yaml", {}) | ||
} | ||
} | ||
|
||
|
||
resource "azurerm_api_management_product_api" "rtp_service_provider_product_api" { | ||
api_management_name = data.azurerm_api_management.this.name | ||
resource_group_name = data.azurerm_api_management.this.resource_group_name | ||
|
||
api_name = azurerm_api_management_api.rtp_service_provider_api.name | ||
product_id = azurerm_api_management_product.rtp.product_id | ||
depends_on = [azurerm_api_management_product.rtp, azurerm_api_management_api.rtp_service_provider_api] | ||
} | ||
|
||
## Override API Operations Policies ## | ||
resource "azurerm_api_management_api_operation_policy" "rtp_service_provider_create_rtp_policy" { | ||
api_name = azurerm_api_management_api.rtp_service_provider_api.name | ||
api_management_name = azurerm_api_management_api.rtp_service_provider_api.api_management_name | ||
resource_group_name = azurerm_api_management_api.rtp_service_provider_api.resource_group_name | ||
operation_id = "createRtp" | ||
|
||
xml_content = templatefile("./api/pagopa/create_rtp_mock_policy.xml", { | ||
base_url : "${local.rtp_base_url}/${azurerm_api_management_api.rtp_service_provider_api.path}/${azurerm_api_management_api.rtp_service_provider_api.version}/rtps" | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!-- | ||
IMPORTANT: | ||
- Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements. | ||
- To apply a policy to the incoming request (before it is forwarded to the backend service), place a corresponding policy element within the <inbound> section element. | ||
- To apply a policy to the outgoing response (before it is sent back to the caller), place a corresponding policy element within the <outbound> section element. | ||
- To add a policy, place the cursor at the desired insertion point and select a policy from the sidebar. | ||
- To remove a policy, delete the corresponding policy statement from the policy document. | ||
- Position the <base> element within a section element to inherit all policies from the corresponding section element in the enclosing scope. | ||
- Remove the <base> element to prevent inheriting policies from the corresponding section element in the enclosing scope. | ||
- Policies are applied in the order of their appearance, from the top down. | ||
- Comments within policy elements are not supported and may disappear. Place your comments between policy elements or at a higher level scope. | ||
--> | ||
<policies> | ||
<inbound> | ||
<set-variable name="uuid" value="@(Guid.NewGuid().ToString())"/> | ||
<return-response> | ||
<set-status code="200" reason="OK" /> | ||
<set-header name="Content-Type" exists-action="override"> | ||
<value>application/json</value> | ||
</set-header> | ||
<set-header name="Location" exists-action="override"> | ||
<value>@("${base_url}" + "/" + context.Variables["uuid"])</value> | ||
</set-header> | ||
</return-response> | ||
</inbound> | ||
<backend> | ||
<base /> | ||
</backend> | ||
<outbound> | ||
<base /> | ||
</outbound> | ||
<on-error> | ||
<base /> | ||
</on-error> | ||
</policies> |