Skip to content

Commit

Permalink
fix: Add new url for messageAcknowledge (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-putzu authored Oct 29, 2024
1 parent 3b30c58 commit 4ab1f42
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 33 deletions.
31 changes: 31 additions & 0 deletions infra/apim_v2/api/api_key_fn_op_policy_message.xml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<policies>
<inbound>
<base/>
<choose>
<when condition="@(((string)context.Product.Id).Contains(" prod-fd"))">
<validate-jwt header-name="Authorization" failed-validation-httpcode="401"
failed-validation-error-message="Unauthorized" require-expiration-time="false"
require-scheme="Bearer" require-signed-tokens="true">
<openid-config url="https://login.microsoftonline.com/${TENANT_ID}/.well-known/openid-configuration"/>
<required-claims>
<claim name="aud" match="all">
<value>${EXTERNAL-OAUTH2-ISSUER}</value>
</claim>
</required-claims>
</validate-jwt>
</when>
</choose>
<set-variable name="fnkey" value="${FN_KEY}"/>
<set-header name="X-FUNCTIONS-KEY" exists-action="override">
<value>@((string)context.Variables["fnkey"])</value>
</set-header>
<set-backend-service base-url="${BACKEND_BASE_URL}"/>
<rewrite-uri template="@("/api/acknowledgment/" + (string)context.Variables["productId"] + "/message/{messageId}/status/{status}")" />
</inbound>
<backend>
<base/>
</backend>
<on-error>
<base/>
</on-error>
</policies>
2 changes: 1 addition & 1 deletion infra/apim_v2/api/ms_external_api/v2/openapi.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@
]
}
},
"/api/acknowledgment/{productId}/message/{messageId}/status/{status}": {
"/message/{messageId}/status/{status}": {
"post": {
"tags": [],
"summary": "messageAcknowledgment",
Expand Down
155 changes: 127 additions & 28 deletions infra/apim_v2/api/ms_external_api/v2/openapi.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@
"tags": [
"User"
],
"summary": "Retrieves user given userId and optional ProductId",
"summary": "Retrieve user information by userId and optional ProductId",
"description": "Retrieves user given userId and optional ProductId",
"operationId": "getUserInfoUsingGET",
"parameters": [
{
Expand Down Expand Up @@ -1385,10 +1386,118 @@
}
]
}
},
"/message/{messageId}/status/{status}": {
"post": {
"tags": [],
"summary": "messageAcknowledgment",
"description": "Service to acknowledge message consumption by a consumer",
"operationId": "messageAcknowledgmentUsingPOST",
"parameters": [
{
"name": "productId",
"in": "path",
"description": "Product's unique identifier",
"required": true,
"style": "simple",
"schema": {
"type": "string"
}
},
{
"name": "messageId",
"in": "path",
"description": "Kafka message unique identifier",
"required": true,
"style": "simple",
"schema": {
"type": "string"
}
},
{
"name": "status",
"in": "path",
"description": "Kafka message consumption acknowledgment status",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"enum": [
"ACK",
"NACK"
]
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AckPayloadRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
}
},
"security": [
{
"bearerAuth": [
"global"
]
}
]
}
}
},
"components": {
"schemas": {
"AckPayloadRequest": {
"title": "AckPayloadRequest",
"required": [
"message"
],
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Acknowledgment request payload message"
}
}
},
"DelegationResponse": {
"title": "DelegationResponse",
"type": "object",
Expand Down Expand Up @@ -1422,19 +1531,7 @@
"type": "string"
},
"institutionType": {
"type": "string",
"enum": [
"AS",
"CON",
"GSP",
"PA",
"PG",
"PSP",
"PT",
"REC",
"SA",
"SCP"
]
"type": "string"
},
"productId": {
"type": "string"
Expand Down Expand Up @@ -1593,19 +1690,7 @@
"type": "boolean"
},
"institutionType": {
"type": "string",
"enum": [
"AS",
"CON",
"GSP",
"PA",
"PG",
"PSP",
"PT",
"REC",
"SA",
"SCP"
]
"type": "string"
},
"istatCode": {
"type": "string"
Expand Down Expand Up @@ -2010,6 +2095,12 @@
"multiroleAllowed": {
"type": "boolean"
},
"phasesAdditionAllowed": {
"type": "array",
"items": {
"type": "string"
}
},
"roles": {
"type": "array",
"items": {
Expand All @@ -2030,6 +2121,9 @@
},
"label": {
"type": "string"
},
"productLabel": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -2360,6 +2454,10 @@
"type": "string",
"description": "The specific role of the user related to the product."
},
"productRoleLabel": {
"type": "string",
"description": "The specific role label of the user related to the product."
},
"role": {
"type": "string",
"description": "Available values: MANAGER, DELEGATE, SUB_DELEGATE, OPERATOR, ADMIN_EA"
Expand Down Expand Up @@ -2693,7 +2791,8 @@
"description": "Institution's share capital value"
}
}
},"DpoDataResource": {
},
"DpoDataResource": {
"title": "DpoDataResource",
"type": "object",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion infra/apim_v2/api/ms_external_api/v2/openapi.uat.json
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@
]
}
},
"/api/acknowledgment/{productId}/message/{messageId}/status/{status}": {
"/message/{messageId}/status/{status}": {
"post": {
"tags": [],
"summary": "messageAcknowledgment",
Expand Down
8 changes: 5 additions & 3 deletions infra/apim_v2/apim.tf
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,11 @@ module "apim_external_api_ms_v2" {
},
{
operation_id = "messageAcknowledgmentUsingPOST"
xml_content = templatefile("./api/api_key_fn_op_policy.xml.tpl", {
BACKEND_BASE_URL = "https://selc-${var.env_short}-onboarding-fn.azurewebsites.net"
FN_KEY = data.azurerm_key_vault_secret.fn-onboarding-primary-key.value
xml_content = templatefile("./api/api_key_fn_op_policy_message.xml.tpl", {
BACKEND_BASE_URL = "https://selc-${var.env_short}-onboarding-fn.azurewebsites.net"
FN_KEY = data.azurerm_key_vault_secret.fn-onboarding-primary-key.value
EXTERNAL-OAUTH2-ISSUER = data.azurerm_key_vault_secret.external-oauth2-issuer.value
TENANT_ID = data.azurerm_client_config.current.tenant_id
})
}
]
Expand Down

0 comments on commit 4ab1f42

Please sign in to comment.