Skip to content

Commit

Permalink
Merge pull request #7 from pagopa/VAS-506-add-operative-table-helpdes…
Browse files Browse the repository at this point in the history
…k-api

[VAS-506] feat: Add operative table helpdesk API
  • Loading branch information
jacopocarlini authored Mar 6, 2024
2 parents 2d88c20 + 98f4a65 commit 4cb37bd
Show file tree
Hide file tree
Showing 34 changed files with 2,026 additions and 597 deletions.
56 changes: 39 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,44 @@
# Template for Java Spring Microservice project

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=TODO-set-your-id&metric=alert_status)](https://sonarcloud.io/dashboard?id=TODO-set-your-id)
[![Integration Tests](https://github.com/pagopa/<TODO-repo>/actions/workflows/integration_test.yml/badge.svg?branch=main)](https://github.com/pagopa/<TODO-repo>/actions/workflows/integration_test.yml)

TODO: add a description

TODO: generate a index with this tool: https://ecotrust-canada.github.io/markdown-toc/

TODO: resolve all the TODOs in this template
# BackOffice External

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=pagopa_pagopa-backoffice-external&metric=alert_status)](https://sonarcloud.io/dashboard?id=pagopa_pagopa-backoffice-external)
[![Integration Tests](https://github.com/pagopa/pagopa-backoffice-external/actions/workflows/integration_test.yml/badge.svg?branch=main)](https://github.com/pagopa/pagopa-backoffice-external/actions/workflows/integration_test.yml)

Microservice with external APIs of PagoPA Backoffice

- [BackOffice External](#backoffice-external)
* [Api Documentation 📖](#api-documentation-)
* [Technology Stack](#technology-stack)
* [Start Project Locally 🚀](#start-project-locally-)
+ [Prerequisites](#prerequisites)
+ [Run docker container](#run-docker-container)
* [Develop Locally 💻](#develop-locally-)
+ [Prerequisites](#prerequisites-1)
+ [Run the project](#run-the-project)
- [Local Environment](#local-environment)
+ [Spring Profiles](#spring-profiles)
+ [Testing 🧪](#testing-)
- [Unit testing](#unit-testing)
- [Integration testing](#integration-testing)
- [Performance testing](#performance-testing)
* [Contributors 👥](#contributors-)
+ [Maintainers](#maintainers)

---

## Api Documentation 📖

See the [OpenApi 3 here.](https://editor.swagger.io/?url=https://raw.githubusercontent.com/pagopa/<TODO-repo>/main/openapi/openapi.json)
See the [OpenApi 3 here.](https://editor.swagger.io/?url=https://raw.githubusercontent.com/pagopa/pagopa-backoffice-externalmain/openapi/openapi.json)

---

## Technology Stack

- Java 11
- Java 17
- Spring Boot
- Spring Web
- Hibernate
- JPA
- ...
- TODO
- Maven 3

---

Expand All @@ -51,13 +64,22 @@ from `./docker` directory

- git
- maven
- jdk-11
- jdk-17

### Run the project

Start the springboot application with this command:

`mvn spring-boot:run -Dspring-boot.run.profiles=local`
`mvn spring-boot:run -Dspring.profiles.active=local`

#### Local Environment

👀 You need to put in your local environment some variables

| VARIABLE | USAGE | DEFAULT VALUE |
|--------------------------------|---------------------------------------------|:-----------------:|
| `MONGODB_CONNECTION_URI` | Connection string to the Backoffice MongoDB | |
| `MONGODB_NAME` | Name of the Backoffice MongoDB | pagopaBackoffice |

### Spring Profiles

Expand Down Expand Up @@ -91,6 +113,6 @@ install [k6](https://k6.io/) and then from `./performance-test/src`

Made with ❤️ by PagoPa S.p.A.

### Mainteiners
### Maintainers

See `CODEOWNERS` file
111 changes: 75 additions & 36 deletions infra/04_apim_api.tf
Original file line number Diff line number Diff line change
@@ -1,64 +1,103 @@
locals {
repo_name = "pagopa-backoffice-external"
apim_backoffice_external_api = {
// Backoffice External
display_name = "Selfcare Backoffice External Product pagoPA"
description = "API for Backoffice External"
path = "backoffice/external"
subscription_required = true
service_url = null
}
apim_backoffice_helpdesk_api = {
// Helpdesk
display_name = "Selfcare Backoffice Helpdesk Product pagoPA"
description = "API for Backoffice Helpdesk"
path = "backoffice/helpdesk"
subscription_required = true
service_url = null
}

display_name = "Selfcare Backoffice External Product pagoPA"
description = "API for Backoffice External"
path = "backoffice/external"

host = "api.${var.apim_dns_zone_prefix}.${var.external_domain}"
hostname = var.hostname
host = "api.${var.apim_dns_zone_prefix}.${var.external_domain}"
hostname = var.hostname
}

resource "azurerm_api_management_group" "api_group" {
name = local.apim.product_id
##############
## Api Vers ##
##############

resource "azurerm_api_management_api_version_set" "api_backoffice_external_api" {

name = format("%s-backoffice-external-api", var.env_short)
resource_group_name = local.apim.rg
api_management_name = local.apim.name
display_name = local.display_name
description = local.description
display_name = local.apim_backoffice_external_api.display_name
versioning_scheme = "Segment"
}

resource "azurerm_api_management_api_version_set" "api_version_set" {
name = format("%s-${local.repo_name}", var.env_short)
resource "azurerm_api_management_api_version_set" "api_backoffice_helpdesk_api" {

name = format("%s-backoffice-helpdesk-api", var.env_short)
resource_group_name = local.apim.rg
api_management_name = local.apim.name
display_name = local.display_name
display_name = local.apim_backoffice_helpdesk_api.display_name
versioning_scheme = "Segment"
}

module "api_v1" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v6.7.0"

name = format("%s-${local.repo_name}", var.env_short)
##############
## OpenApi ##
##############

module "apim_api_backoffice_external_api_v1" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v6.4.1"

name = format("%s-backoffice-external-api", var.env_short)
api_management_name = local.apim.name
resource_group_name = local.apim.rg
product_ids = [local.apim.product_id]
subscription_required = true

version_set_id = azurerm_api_management_api_version_set.api_version_set.id
api_version = "v1"
product_ids = [local.apim.bo_external_product_id]
subscription_required = local.apim_backoffice_external_api.subscription_required
version_set_id = azurerm_api_management_api_version_set.api_backoffice_external_api.id
api_version = "v1"

description = local.description
display_name = local.display_name
path = local.path
description = local.apim_backoffice_external_api.description
display_name = local.apim_backoffice_external_api.display_name
path = local.apim_backoffice_external_api.path
protocols = ["https"]

service_url = null
service_url = local.apim_backoffice_external_api.service_url

content_format = "openapi"
content_value = templatefile("../openapi/openapi.json", {
content_value = templatefile("../openapi/openapi_backoffice_external.json", {
host = local.host
})

xml_content = templatefile("./policy/_base_policy.xml", {
hostname = var.hostname
xml_content = templatefile("./api/backoffice-external/v1/_base_policy.xml", {
hostname = local.hostname
})
}

api_operation_policies = [
{
operation_id = "getCreditorInstitutions",
xml_content = templatefile("./api/pagopa-backoffice-external/_get_broker_institutions_policy.xml", {})
},
]
module "apim_api_backoffice_helpdesk_api_v1" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v6.4.1"

}
name = format("%s-backoffice-helpdesk-api", var.env_short)
api_management_name = local.apim.name
resource_group_name = local.apim.rg
product_ids = [local.apim.bo_helpdesk_product_id]
subscription_required = local.apim_backoffice_helpdesk_api.subscription_required
version_set_id = azurerm_api_management_api_version_set.api_backoffice_helpdesk_api.id
api_version = "v1"

description = local.apim_backoffice_helpdesk_api.description
display_name = local.apim_backoffice_helpdesk_api.display_name
path = local.apim_backoffice_helpdesk_api.path
protocols = ["https"]
service_url = local.apim_backoffice_helpdesk_api.service_url

content_format = "openapi"
content_value = templatefile("../openapi/openapi_backoffice_helpdesk.json", {
host = local.host
})

xml_content = templatefile("./api/backoffice-helpdesk/v1/_base_policy.xml", {
hostname = local.hostname
})
}
7 changes: 4 additions & 3 deletions infra/99_locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ locals {
product = "${var.prefix}-${var.env_short}"

apim = {
name = "${local.product}-apim"
rg = "${local.product}-api-rg"
product_id = "TODO" # TODO product id to import from pagopa-infra
name = "${local.product}-apim"
rg = "${local.product}-api-rg"
bo_external_product_id = "selfcare-bo-external"
bo_helpdesk_product_id = "selfcare-bo-helpdesk"
}
}

Loading

0 comments on commit 4cb37bd

Please sign in to comment.