diff --git a/.gitignore b/.gitignore index bad85f2..f5cac04 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,4 @@ sonar-project.properties #Helm **/Chart.lock +.java-version diff --git a/Dockerfile b/Dockerfile index 3ef25a3..18205ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ RUN addgroup --gid 2000 --system appgroup && \ adduser --uid 2000 --system appuser --gid 2000 WORKDIR /app -COPY --from=builder --chown=appuser:appgroup /app/build/libs/hmpps-template-kotlin*.jar /app/app.jar +COPY --from=builder --chown=appuser:appgroup /app/build/libs/hmpps-person-integration-api*.jar /app/app.jar COPY --from=builder --chown=appuser:appgroup /app/build/libs/applicationinsights-agent*.jar /app/agent.jar COPY --from=builder --chown=appuser:appgroup /app/applicationinsights.json /app COPY --from=builder --chown=appuser:appgroup /app/applicationinsights.dev.json /app diff --git a/README.md b/README.md index b4955a5..75e9dee 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# hmpps-template-kotlin +# hmpps-person-integration-api -[![repo standards badge](https://img.shields.io/badge/endpoint.svg?&style=flat&logo=github&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fhmpps-template-kotlin)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-report/hmpps-template-kotlin "Link to report") -[![Docker Repository on ghcr](https://img.shields.io/badge/ghcr.io-repository-2496ED.svg?logo=docker)](https://ghcr.io/ministryofjustice/hmpps-template-kotlin) -[![API docs](https://img.shields.io/badge/API_docs_-view-85EA2D.svg?logo=swagger)](https://hmpps-template-kotlin-dev.hmpps.service.justice.gov.uk/webjars/swagger-ui/index.html?configUrl=/v3/api-docs) +[![repo standards badge](https://img.shields.io/badge/endpoint.svg?&style=flat&logo=github&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fhmpps-person-integration-api)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-report/hmpps-person-integration-api "Link to report") +[![Docker Repository on ghcr](https://img.shields.io/badge/ghcr.io-repository-2496ED.svg?logo=docker)](https://ghcr.io/ministryofjustice/hmpps-person-integration-api) +[![API docs](https://img.shields.io/badge/API_docs_-view-85EA2D.svg?logo=swagger)](https://hmpps-person-integration-api-dev.hmpps.service.justice.gov.uk/webjars/swagger-ui/index.html?configUrl=/v3/api-docs) Template github repo used for new Kotlin based projects. @@ -16,7 +16,7 @@ within GitHub. This project is community managed by the mojdt `#kotlin-dev` slack channel. Please raise any questions or queries there. Contributions welcome! -Our security policy is located [here](https://github.com/ministryofjustice/hmpps-template-kotlin/security/policy). +Our security policy is located [here](https://github.com/ministryofjustice/hmpps-person-integration-api/security/policy). Documentation to create new service is located [here](https://tech-docs.hmpps.service.justice.gov.uk/applicationplatform/newservice-GHA/). @@ -24,12 +24,12 @@ Documentation to create new service is located [here](https://tech-docs.hmpps.se When deploying to a new namespace, you may wish to use the [templates project namespace](https://github.com/ministryofjustice/cloud-platform-environments/tree/main/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-templates-dev) -as the basis for your new namespace. This namespace contains both the kotlin and typescript template projects, +as the basis for your new namespace. This namespace contains both the kotlin and typescript template projects, which is the usual way that projects are setup. Copy this folder and update all the existing namespace references to correspond to the environment to which you're deploying. -If you only need the kotlin configuration then remove all typescript references and remove the elasticache configuration. +If you only need the kotlin configuration then remove all typescript references and remove the elasticache configuration. To ensure the correct github teams can approve releases, you will need to make changes to the configuration in `resources/service-account-github` where the appropriate team names will need to be added (based on [lines 98-100](https://github.com/ministryofjustice/cloud-platform-environments/blob/main/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-templates-dev/resources/serviceaccount-github.tf#L98) and the reference appended to the teams list below [line 112](https://github.com/ministryofjustice/cloud-platform-environments/blob/main/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-templates-dev/resources/serviceaccount-github.tf#L112)). Note: hmpps-sre is in this list to assist with deployment issues. @@ -129,7 +129,7 @@ will build the application and run it and HMPPS Auth within a local docker insta ### Running the application in Intellij ```bash -docker compose pull && docker compose up --scale hmpps-template-kotlin=0 +docker compose pull && docker compose up --scale hmpps-person-integration-api=0 ``` will just start a docker instance of HMPPS Auth. The application should then be started with a `dev` active profile diff --git a/applicationinsights.dev.json b/applicationinsights.dev.json index 92b3d80..76dc7f4 100644 --- a/applicationinsights.dev.json +++ b/applicationinsights.dev.json @@ -1,6 +1,6 @@ { "role": { - "name": "hmpps-template-kotlin" + "name": "hmpps-person-integration-api" }, "customDimensions": { "service.version": "${BUILD_NUMBER}" diff --git a/applicationinsights.json b/applicationinsights.json index 439395d..f4e9f39 100644 --- a/applicationinsights.json +++ b/applicationinsights.json @@ -1,6 +1,6 @@ { "role": { - "name": "hmpps-template-kotlin" + "name": "hmpps-person-integration-api" }, "customDimensions": { "service.version": "${BUILD_NUMBER}" diff --git a/docker-compose.yml b/docker-compose.yml index 86609dd..3c10306 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,11 @@ version: "3" services: - hmpps-template-kotlin: + hmpps-person-integration-api: build: context: . networks: - hmpps - container_name: hmpps-template-kotlin + container_name: hmpps-person-integration-api ports: - "8080:8080" healthcheck: @@ -14,7 +14,7 @@ services: - SERVER_PORT=8080 - HMPPS_AUTH_URL=http://hmpps-auth:8080/auth # TODO: Remove this URL and replace with outgoing service URLs - - EXAMPLE_URL=http://hmpps-template-kotlin:8080 + - EXAMPLE_URL=http://hmpps-person-integration-api:8080 - SPRING_PROFILES_ACTIVE=dev hmpps-auth: diff --git a/helm_deploy/hmpps-template-kotlin/.helmignore b/helm_deploy/hmpps-person-integration-api/.helmignore similarity index 100% rename from helm_deploy/hmpps-template-kotlin/.helmignore rename to helm_deploy/hmpps-person-integration-api/.helmignore diff --git a/helm_deploy/hmpps-template-kotlin/Chart.yaml b/helm_deploy/hmpps-person-integration-api/Chart.yaml similarity index 90% rename from helm_deploy/hmpps-template-kotlin/Chart.yaml rename to helm_deploy/hmpps-person-integration-api/Chart.yaml index ab15c41..243c32e 100644 --- a/helm_deploy/hmpps-template-kotlin/Chart.yaml +++ b/helm_deploy/hmpps-person-integration-api/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 appVersion: '1.0' description: A Helm chart for Kubernetes -name: hmpps-template-kotlin +name: hmpps-person-integration-api version: 0.2.0 dependencies: - name: generic-service diff --git a/helm_deploy/hmpps-template-kotlin/values.yaml b/helm_deploy/hmpps-person-integration-api/values.yaml similarity index 74% rename from helm_deploy/hmpps-template-kotlin/values.yaml rename to helm_deploy/hmpps-person-integration-api/values.yaml index 5c87bc2..b7586a2 100644 --- a/helm_deploy/hmpps-template-kotlin/values.yaml +++ b/helm_deploy/hmpps-person-integration-api/values.yaml @@ -1,18 +1,18 @@ generic-service: - nameOverride: hmpps-template-kotlin - productId: "UNASSIGNED" # productId for the product that this belongs too, i.e. DPS001, see README.md for details + nameOverride: hmpps-person-integration-api + productId: "HMPPS517" # productId for the product that this belongs too, i.e. DPS001, see README.md for details replicaCount: 4 image: - repository: ghcr.io/ministryofjustice/hmpps-template-kotlin + repository: ghcr.io/ministryofjustice/hmpps-person-integration-api tag: app_version # override at deployment time port: 8080 ingress: enabled: true host: app-hostname.local # override per environment - tlsSecretName: hmpps-template-kotlin-cert + tlsSecretName: hmpps-person-integration-api-cert # Environment variables to load into the deployment env: @@ -27,7 +27,7 @@ generic-service: # [name of environment variable as seen by app]: [key of kubernetes secret to load] namespace_secrets: - hmpps-template-kotlin: + hmpps-person-integration-api: # Example client registration secrets EXAMPLE_API_CLIENT_ID: "TEMPLATE_KOTLIN_API_CLIENT_ID" EXAMPLE_API_CLIENT_SECRET: "TEMPLATE_KOTLIN_API_CLIENT_SECRET" @@ -39,4 +39,4 @@ generic-service: - internal generic-prometheus-alerts: - targetApplication: hmpps-template-kotlin + targetApplication: hmpps-person-integration-api diff --git a/helm_deploy/values-dev.yaml b/helm_deploy/values-dev.yaml index c04e87b..05162d9 100644 --- a/helm_deploy/values-dev.yaml +++ b/helm_deploy/values-dev.yaml @@ -1,20 +1,20 @@ --- -# Per environment values which override defaults in hmpps-template-kotlin/values.yaml +# Per environment values which override defaults in hmpps-person-integration-api/values.yaml generic-service: replicaCount: 2 ingress: - host: template-kotlin-dev.hmpps.service.justice.gov.uk + host: person-integration-api-dev.hmpps.service.justice.gov.uk env: APPLICATIONINSIGHTS_CONFIGURATION_FILE: "applicationinsights.dev.json" HMPPS_AUTH_URL: "https://sign-in-dev.hmpps.service.justice.gov.uk/auth" # Template kotlin calls out to itself to provide an example of a service call # TODO: This should be replaced by a call to a different service, or removed - EXAMPLE_API_URL: "https://template-kotlin-dev.hmpps.service.justice.gov.uk" + EXAMPLE_API_URL: "https://person-integration-api-dev.hmpps.service.justice.gov.uk" # CloudPlatform AlertManager receiver to route prometheus alerts to slack # See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts generic-prometheus-alerts: - alertSeverity: NON_PROD_ALERTS_SEVERITY_LABEL + alertSeverity: digital-prison-service-dev diff --git a/helm_deploy/values-preprod.yaml b/helm_deploy/values-preprod.yaml index 18164b9..ceae048 100644 --- a/helm_deploy/values-preprod.yaml +++ b/helm_deploy/values-preprod.yaml @@ -1,20 +1,20 @@ --- -# Per environment values which override defaults in hmpps-template-kotlin/values.yaml +# Per environment values which override defaults in hmpps-person-integration-api/values.yaml generic-service: replicaCount: 2 ingress: - host: template-kotlin-preprod.hmpps.service.justice.gov.uk + host: person-integration-api-preprod.hmpps.service.justice.gov.uk env: APPLICATIONINSIGHTS_CONFIGURATION_FILE: "applicationinsights.dev.json" HMPPS_AUTH_URL: "https://sign-in-preprod.hmpps.service.justice.gov.uk/auth" # Template kotlin calls out to itself to provide an example of a service call # TODO: This should be replaced by a call to a different service, or removed - EXAMPLE_API_URL: "https://template-kotlin-preprod.hmpps.service.justice.gov.uk" + EXAMPLE_API_URL: "https://person-integration-api-preprod.hmpps.service.justice.gov.uk" # CloudPlatform AlertManager receiver to route prometheus alerts to slack # See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts generic-prometheus-alerts: - alertSeverity: NON_PROD_ALERTS_SEVERITY_LABEL + alertSeverity: digital-prison-service-dev diff --git a/helm_deploy/values-prod.yaml b/helm_deploy/values-prod.yaml index f76bcf2..482bc4f 100644 --- a/helm_deploy/values-prod.yaml +++ b/helm_deploy/values-prod.yaml @@ -1,17 +1,17 @@ --- -# Per environment values which override defaults in hmpps-template-kotlin/values.yaml +# Per environment values which override defaults in hmpps-person-integration-api/values.yaml generic-service: ingress: - host: template-kotlin.hmpps.service.justice.gov.uk + host: person-integration-api.hmpps.service.justice.gov.uk env: HMPPS_AUTH_URL: "https://sign-in.hmpps.service.justice.gov.uk/auth" # Template kotlin calls out to itself to provide an example of a service call # TODO: This should be replaced by a call to a different service, or removed - EXAMPLE_API_URL: "https://template-kotlin.hmpps.service.justice.gov.uk" + EXAMPLE_API_URL: "https://person-integration-api.hmpps.service.justice.gov.uk" # CloudPlatform AlertManager receiver to route prometheus alerts to slack # See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts generic-prometheus-alerts: - alertSeverity: PROD_ALERTS_SEVERITY_LABEL + alertSeverity: digital-prison-service diff --git a/rename-project.bash b/rename-project.bash deleted file mode 100755 index 7279c6c..0000000 --- a/rename-project.bash +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if ! echo "$BASH_VERSION" | grep -E "^[45]" &>/dev/null; then - echo "Found bash version: $BASH_VERSION" - echo "Ensure you are using bash version 4 or 5" - exit 1 -fi - -if [[ $# -ge 1 ]]; then - PROJECT_INPUT=$1 - SLACK_RELEASES_CHANNEL=$2 - SECURITY_ALERTS_SLACK_CHANNEL_ID=$3 - NON_PROD_ALERTS_SEVERITY_LABEL=$4 - PROD_ALERTS_SEVERITY_LABEL=$5 - PRODUCT_ID=$6 -else - read -rp "New project name e.g. prison-visits >" PROJECT_INPUT - read -rp "Slack channel for release notifications >" SLACK_RELEASES_CHANNEL - read -rp "Slack channel for pipeline security notifications >" SECURITY_ALERTS_SLACK_CHANNEL_ID - echo "For configurating alert severity labels, please first see https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts" - read -rp "Non-prod kubernetes alerts. The severity label used by prometheus to route alert notifications to slack >" NON_PROD_ALERTS_SEVERITY_LABEL - read -rp "Production kubernetes alerts. The severity label used by prometheus to route alert notifications to slack >" PROD_ALERTS_SEVERITY_LABEL - echo "Refer to the developer portal at https://developer-portal.hmpps.service.justice.gov.uk/products to find your product id." - read -rp "Provide an ID for the product this app/component belongs too >" PRODUCT_ID -fi - -PROJECT_NAME_LOWER=${PROJECT_INPUT,,} # lowercase -PROJECT_NAME_HYPHENS=${PROJECT_NAME_LOWER// /-} # spaces to hyphens - -PROJECT_NAME=${PROJECT_NAME_HYPHENS//[^a-z0-9-]/} # remove all other characters -PROJECT_NAME_WITHOUT_HMPPS=${PROJECT_NAME/hmpps-/} # remove hmpps prefix -PACKAGE_NAME=${PROJECT_NAME_WITHOUT_HMPPS//-/} # remove hyphen - -read -ra PROJECT_NAME_ARRAY <<<"${PROJECT_NAME//-/ }" # convert to array -PROJECT_DESCRIPTION_HMPPS_LOWER=${PROJECT_NAME_ARRAY[*]^} # convert array back to string thus capitalising first character -PROJECT_DESCRIPTION=${PROJECT_DESCRIPTION_HMPPS_LOWER/Hmpps/HMPPS} # ensure that HMPPS is capitalised -CLASS_NAME=${PROJECT_DESCRIPTION_HMPPS_LOWER// /} # then remove spaces - -echo "Found: Project of $PROJECT_DESCRIPTION" -echo " Project name of $PROJECT_NAME" -echo " Package name of $PACKAGE_NAME" -echo " Class name of $CLASS_NAME" - -echo "Performing search and replace" - -# exclude files that get in the way and don't make any difference -EXCLUDES="( -path ./build -o -path ./out -o -path ./.git -o -path ./.gradle -o -path ./gradle -o -path ./.idea -o -path ./rename-project.bash )" -# shellcheck disable=SC2086 -find . $EXCLUDES -prune -o -type f -exec sed -i \ - -e "s/hmpps-template-kotlin/$PROJECT_NAME/g" \ - -e "s/template-kotlin/$PROJECT_NAME_WITHOUT_HMPPS/g" \ - -e "s/HMPPS Template Kotlin/$PROJECT_DESCRIPTION/g" \ - -e "s/HmppsTemplateKotlin/$CLASS_NAME/g" \ - -e "s/templatepackagename/$PACKAGE_NAME/g" {} \; - -echo "Performing directory renames" - -# move package directory to new name -BASE="kotlin/uk/gov/justice/digital/hmpps" -mv "src/test/${BASE}/templatepackagename" "src/test/$BASE/$PACKAGE_NAME" -mv "src/main/${BASE}/templatepackagename" "src/main/$BASE/$PACKAGE_NAME" - -# and move helm stuff to new name -mv "helm_deploy/hmpps-template-kotlin" "helm_deploy/$PROJECT_NAME" - -# Update helm values.yaml with product ID. -sed -i -z -E \ - -e "s/UNASSIGNED/$PRODUCT_ID/" \ - helm_deploy/$PROJECT_NAME/values.yaml - -# Update helm values files with correct slack channels. -sed -i -z -E \ - -e "s/NON_PROD_ALERTS_SEVERITY_LABEL/$NON_PROD_ALERTS_SEVERITY_LABEL/" \ - helm_deploy/values-dev.yaml helm_deploy/values-preprod.yaml - -sed -i -z -E \ - -e "s/PROD_ALERTS_SEVERITY_LABEL/$PROD_ALERTS_SEVERITY_LABEL/" helm_deploy/values-prod.yaml - -# rename kotlin files -mv "src/main/$BASE/$PACKAGE_NAME/HmppsTemplateKotlin.kt" "src/main/$BASE/$PACKAGE_NAME/$CLASS_NAME.kt" -mv "src/main/$BASE/$PACKAGE_NAME/config/HmppsTemplateKotlinExceptionHandler.kt" "src/main/$BASE/$PACKAGE_NAME/config/${CLASS_NAME}ExceptionHandler.kt" - -# change cron job to be random time otherwise we hit rate limiting with veracode -RANDOM_HOUR=$((RANDOM % (9 - 3 + 1) + 3)) -RANDOM_MINUTE=$(($RANDOM%60)) -RANDOM_MINUTE2=$(($RANDOM%60)) -sed -i -z -E \ - -e "s/SLACK_RELEASES_CHANNEL/$SLACK_RELEASES_CHANNEL/" \ - .circleci/config.yml - -echo "NEEDS TO BE SET MANUALLY" -echo "========================" -echo "DAILY CRON: ${RANDOM_MINUTE} ${RANDOM_HOUR}" -echo "WEEKLY CRON: ${RANDOM_MINUTE2} ${RANDOM_HOUR}" -echo "SLACK CHANNEL: ${SECURITY_ALERTS_SLACK_CHANNEL_ID}" - -# TEMPORARILY REMOVED - THIS WILL NEED TO BE DONE MANUALLY UNTIL WE MOVE TO GITHUB ACTIONS BOOTSTRAP -# sed -i -z -E \ -# -e "s/on:\n workflow_dispatch:\n schedule:\n - cron: \"19 6/on:\n workflow_dispatch:\n schedule:\n - cron: \"$RANDOM_MINUTE $RANDOM_HOUR/" \ -# -e "s/on:\n workflow_dispatch:\n schedule:\n - cron: \"34 6/on:\n workflow_dispatch:\n schedule:\n - cron: \"$RANDOM_MINUTE2 $RANDOM_HOUR/" \ -# -e "s/C05J915DX0Q/$SECURITY_ALERTS_SLACK_CHANNEL_ID/" \ -# .github/workflows/* - -# lastly remove ourselves -rm rename-project.bash - -echo "Completed." -echo "Please now review changes and generate a banner for src/main/resources/banner.txt." -echo "There are TODOs in the codebase to guide you through the changes." diff --git a/settings.gradle.kts b/settings.gradle.kts index ec8ec37..fad469a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1 @@ -rootProject.name = "hmpps-template-kotlin" +rootProject.name = "hmpps-person-integration-api" diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/HmppsTemplateKotlin.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/HmppsPersonIntegrationApi.kt similarity index 100% rename from src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/HmppsTemplateKotlin.kt rename to src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/HmppsPersonIntegrationApi.kt diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/config/HmppsTemplateKotlinExceptionHandler.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/config/HmppsPersonIntegrationApiExceptionHandler.kt similarity index 98% rename from src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/config/HmppsTemplateKotlinExceptionHandler.kt rename to src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/config/HmppsPersonIntegrationApiExceptionHandler.kt index acfe35d..af53e32 100644 --- a/src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/config/HmppsTemplateKotlinExceptionHandler.kt +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/config/HmppsPersonIntegrationApiExceptionHandler.kt @@ -14,7 +14,7 @@ import org.springframework.web.servlet.resource.NoResourceFoundException import uk.gov.justice.hmpps.kotlin.common.ErrorResponse @RestControllerAdvice -class HmppsTemplateKotlinExceptionHandler { +class HmppsPersonIntegrationApiExceptionHandler { @ExceptionHandler(ValidationException::class) fun handleValidationException(e: ValidationException): ResponseEntity = ResponseEntity .status(BAD_REQUEST) diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/config/OpenApiConfiguration.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/config/OpenApiConfiguration.kt similarity index 80% rename from src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/config/OpenApiConfiguration.kt rename to src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/config/OpenApiConfiguration.kt index 87e5f69..5b5e071 100644 --- a/src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/config/OpenApiConfiguration.kt +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/config/OpenApiConfiguration.kt @@ -20,9 +20,9 @@ class OpenApiConfiguration(buildProperties: BuildProperties) { fun customOpenAPI(): OpenAPI = OpenAPI() .servers( listOf( - Server().url("https://template-kotlin-dev.hmpps.service.justice.gov.uk").description("Development"), - Server().url("https://template-kotlin-preprod.hmpps.service.justice.gov.uk").description("Pre-Production"), - Server().url("https://template-kotlin.hmpps.service.justice.gov.uk").description("Production"), + Server().url("https://person-integration-api-dev.hmpps.service.justice.gov.uk").description("Development"), + Server().url("https://person-integration-api-preprod.hmpps.service.justice.gov.uk").description("Pre-Production"), + Server().url("https://person-integration-api.hmpps.service.justice.gov.uk").description("Production"), Server().url("http://localhost:8080").description("Local"), ), ) @@ -42,11 +42,11 @@ class OpenApiConfiguration(buildProperties: BuildProperties) { // service authorisation requirements .components( Components().addSecuritySchemes( - "template-kotlin-ui-role", + "person-integration-api-ui-role", SecurityScheme().addBearerJwtRequirement("ROLE_TEMPLATE_KOTLIN__UI"), ), ) - .addSecurityItem(SecurityRequirement().addList("template-kotlin-ui-role", listOf("read"))) + .addSecurityItem(SecurityRequirement().addList("person-integration-api-ui-role", listOf("read"))) } private fun SecurityScheme.addBearerJwtRequirement(role: String): SecurityScheme = diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/config/WebClientConfiguration.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/config/WebClientConfiguration.kt similarity index 100% rename from src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/config/WebClientConfiguration.kt rename to src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/config/WebClientConfiguration.kt diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/health/HealthPingCheck.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/health/HealthPingCheck.kt similarity index 100% rename from src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/health/HealthPingCheck.kt rename to src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/health/HealthPingCheck.kt diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/resource/ExampleResource.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/resource/ExampleResource.kt similarity index 95% rename from src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/resource/ExampleResource.kt rename to src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/resource/ExampleResource.kt index 8ece331..2053dc4 100644 --- a/src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/resource/ExampleResource.kt +++ b/src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/resource/ExampleResource.kt @@ -28,7 +28,7 @@ class ExampleResource(private val exampleApiService: ExampleApiService) { @Operation( summary = "Retrieve today's date and time", description = "This is an example endpoint that calls a service to return the current date and time. Requires role ROLE_TEMPLATE_KOTLIN__UI", - security = [SecurityRequirement(name = "template-kotlin-ui-role")], + security = [SecurityRequirement(name = "person-integration-api-ui-role")], responses = [ ApiResponse(responseCode = "200", description = "today's date and time"), ApiResponse( @@ -53,7 +53,7 @@ class ExampleResource(private val exampleApiService: ExampleApiService) { It will return a 404 response as the /example-external-api endpoint hasn't been implemented, so we use wiremock in integration tests to simulate other responses. Requires role ROLE_TEMPLATE_KOTLIN__UI""", - security = [SecurityRequirement(name = "template-kotlin-ui-role")], + security = [SecurityRequirement(name = "person-integration-api-ui-role")], responses = [ ApiResponse(responseCode = "200", description = "a message with a parameter"), ApiResponse( diff --git a/src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/service/ExampleApiService.kt b/src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/service/ExampleApiService.kt similarity index 100% rename from src/main/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/service/ExampleApiService.kt rename to src/main/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/service/ExampleApiService.kt diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 47522e7..d813a27 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -4,7 +4,7 @@ info.app: spring: application: - name: hmpps-template-kotlin + name: hmpps-person-integration-api codec: max-in-memory-size: 10MB diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/ExampleResourceIntTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/ExampleResourceIntTest.kt similarity index 100% rename from src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/ExampleResourceIntTest.kt rename to src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/ExampleResourceIntTest.kt diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/IntegrationTestBase.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/IntegrationTestBase.kt similarity index 100% rename from src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/IntegrationTestBase.kt rename to src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/IntegrationTestBase.kt diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/NotFoundTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/NotFoundTest.kt similarity index 100% rename from src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/NotFoundTest.kt rename to src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/NotFoundTest.kt diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/OpenApiDocsTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/OpenApiDocsTest.kt similarity index 97% rename from src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/OpenApiDocsTest.kt rename to src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/OpenApiDocsTest.kt index 1b6792a..fea041f 100644 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/OpenApiDocsTest.kt +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/OpenApiDocsTest.kt @@ -75,7 +75,7 @@ class OpenApiDocsTest : IntegrationTestBase() { } @ParameterizedTest - @CsvSource(value = ["template-kotlin-ui-role, ROLE_TEMPLATE_KOTLIN__UI"]) + @CsvSource(value = ["person-integration-api-ui-role, ROLE_TEMPLATE_KOTLIN__UI"]) fun `the security scheme is setup for bearer tokens`(key: String, role: String) { webTestClient.get() .uri("/v3/api-docs") diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/ResourceSecurityTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/ResourceSecurityTest.kt similarity index 100% rename from src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/ResourceSecurityTest.kt rename to src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/ResourceSecurityTest.kt diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/health/HealthCheckTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/health/HealthCheckTest.kt similarity index 100% rename from src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/health/HealthCheckTest.kt rename to src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/health/HealthCheckTest.kt diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/health/InfoTest.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/health/InfoTest.kt similarity index 91% rename from src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/health/InfoTest.kt rename to src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/health/InfoTest.kt index f7adf23..45c4614 100644 --- a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/health/InfoTest.kt +++ b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/health/InfoTest.kt @@ -16,7 +16,7 @@ class InfoTest : IntegrationTestBase() { .expectStatus() .isOk .expectBody() - .jsonPath("build.name").isEqualTo("hmpps-template-kotlin") + .jsonPath("build.name").isEqualTo("hmpps-person-integration-api") } @Test diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/wiremock/ExampleApiMockServer.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/wiremock/ExampleApiMockServer.kt similarity index 100% rename from src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/wiremock/ExampleApiMockServer.kt rename to src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/wiremock/ExampleApiMockServer.kt diff --git a/src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/wiremock/HmppsAuthMockServer.kt b/src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/wiremock/HmppsAuthMockServer.kt similarity index 100% rename from src/test/kotlin/uk/gov/justice/digital/hmpps/templatepackagename/integration/wiremock/HmppsAuthMockServer.kt rename to src/test/kotlin/uk/gov/justice/digital/hmpps/personintegrationapi/integration/wiremock/HmppsAuthMockServer.kt