Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dashboard added to APIm #46

Merged
merged 2 commits into from
Nov 15, 2021
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
344 changes: 344 additions & 0 deletions src/core/api/dashboard/v1/dashboard-openapi.json.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,344 @@
{
"openapi": "3.0.3",
"info": {
"title": "selc-dashboard",
"description": "Self Care Dashboard API documentation",
"version": "0.0.1-SNAPSHOT"
},
"servers": [
{
"url": 'https://${host}/${basePath}',
"description": "Inferred Url"
}
],
"tags": [
{
"name": "institutions",
"description": "Institution operations"
},
{
"name": "products",
"description": "Product operations"
}
],
"paths": {
"/institutions/{institutionId}": {
"get": {
"tags": [
"institutions"
],
"summary": "getInstitution",
"description": "The service allows the recovery of an Entity based on its id",
"operationId": "getInstitutionUsingGET",
"parameters": [
{
"name": "institutionId",
"in": "path",
"description": "Institution's unique identifier",
"required": true,
"style": "simple",
"schema": {
"type": "string"
}
},
{
"name": "x-selc-institutionId",
"in": "header",
"description": "Institution's unique identifier",
"required": true,
"allowReserved": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InstitutionResource"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"bearerAuth": [
"global"
]
}
]
}
},
"/institutions/{institutionId}/logo": {
"put": {
"tags": [
"institutions"
],
"summary": "saveInstitutionLogo",
"description": "Service to upload and store the institution's logo",
"operationId": "saveInstitutionLogoUsingPUT",
"parameters": [
{
"name": "institutionId",
"in": "path",
"description": "swagger.dashboard.model.id",
"required": true,
"style": "simple",
"schema": {
"type": "string"
}
},
{
"name": "x-selc-institutionId",
"in": "header",
"description": "Institution's unique identifier",
"required": true,
"allowReserved": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"required": [
"logo"
],
"type": "object",
"properties": {
"logo": {
"type": "string",
"description": "Institution's logo",
"format": "binary"
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object"
}
},
"multipart/form-data": {
"schema": {
"type": "object"
}
}
}
},
"201": {
"description": "Created"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"bearerAuth": [
"global"
]
}
]
}
},
"/products/": {
"get": {
"tags": [
"products"
],
"summary": "getProducts",
"description": "Service that returns the list of PagoPA products",
"operationId": "getProductsUsingGET",
"parameters": [
{
"name": "x-selc-institutionId",
"in": "header",
"description": "Institution's unique identifier",
"required": true,
"allowReserved": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ProductsResource"
}
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"bearerAuth": [
"global"
]
}
]
}
}
},
"components": {
"schemas": {
"InstitutionResource": {
"title": "InstitutionResource",
"required": [
"IPACode",
"category",
"fiscalCode",
"id",
"mailAddress",
"name",
"status",
"userRole"
],
"type": "object",
"properties": {
"IPACode": {
"type": "string",
"description": "IPA code"
},
"category": {
"type": "string",
"description": "Institution's category"
},
"fiscalCode": {
"type": "string",
"description": "Fiscal code corresponding to the institution"
},
"id": {
"type": "string",
"description": "Institution's unique identifier"
},
"mailAddress": {
"type": "string",
"description": "Institution's email address"
},
"name": {
"type": "string",
"description": "Institution's name"
},
"status": {
"type": "string",
"description": "Institution's status"
},
"userRole": {
"type": "string",
"description": "Logged user's role"
}
}
},
"ProductsResource": {
"title": "ProductsResource",
"required": [
"activationDateTime",
"active",
"authorized",
"code",
"id",
"title",
"urlBO"
],
"type": "object",
"properties": {
"activationDateTime": {
"type": "string",
"description": "Date the products was activated/created",
"format": "date-time"
},
"active": {
"type": "boolean",
"description": "flag indicating whether the institution has a valid contract related to the product",
"example": false
},
"authorized": {
"type": "boolean",
"description": "flag indicating whether the logged user has the authorization to manage the product",
"example": false
},
"code": {
"type": "string",
"description": "Product's code"
},
"description": {
"type": "string",
"description": "Product's description"
},
"id": {
"type": "string",
"description": "Product's unique identifier"
},
"logo": {
"type": "string",
"description": "Product's logo"
},
"title": {
"type": "string",
"description": "Product's title"
},
"urlBO": {
"type": "string",
"description": "URL that redirects to the back-office section, where is possible to manage the product"
},
"urlPublic": {
"type": "string",
"description": "URL that redirects to the public information webpage of the product"
}
}
}
},
"securitySchemes": {
"bearerAuth": {
"type": "http",
"description": "A bearer token in the format of a JWS and conformed to the specifications included in [RFC8725](https://tools.ietf.org/html/RFC8725)",
"scheme": "bearer",
"bearerFormat": "JWT"
}
}
}
}
35 changes: 35 additions & 0 deletions src/core/apim.tf
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,38 @@ module "apim_uservice_party_registry_proxy_v1" {
}
]
}

resource "azurerm_api_management_api_version_set" "apim_b4f_dashboard" {
name = format("%s-b4f-dashboard-api", var.env_short)
resource_group_name = azurerm_resource_group.rg_api.name
api_management_name = module.apim.name
display_name = "Self Care Dashboard"
versioning_scheme = "Segment"
}

module "apim_b4f_dashboard_v1" {
source = "git::https://github.com/pagopa/azurerm.git//api_management_api?ref=v1.0.58"
name = format("%s-b4f-dashboard-api-v1", local.project)
api_management_name = module.apim.name
resource_group_name = azurerm_resource_group.rg_api.name
version_set_id = azurerm_api_management_api_version_set.apim_uservice_party_registry_proxy.id


description = "Self Care Dashboard API documentation"
display_name = "Self Care Dashboard V1"
path = "dashboard"
api_version = "v1"
protocols = ["https"]

service_url = format("http://%s/b4f-dashboard", var.reverse_proxy_ip)

content_format = "openapi"
content_value = templatefile("./api/dashboard/v1/dashboard-openapi.json.tpl", {
host = azurerm_api_management_custom_domain.api_custom_domain.proxy[0].host_name
basePath = "dashboard/v1"
})

xml_content = file("./api/base_policy.xml")

subscription_required = false
}