Skip to content

Commit

Permalink
PI-1786 Create initial project for accredited-programmes-and-oasys (#…
Browse files Browse the repository at this point in the history
…3015)

* PI-1786 Create initial project for accredited-programmes-and-oasys

* Create initial project for accredited-programmes-and-oasys

---------

Co-authored-by: Anthony Britton <anthony.britton@digital.justice.gov.uk>
  • Loading branch information
1 parent d438e99 commit 8e0eb0e
Show file tree
Hide file tree
Showing 33 changed files with 599 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ on:
- '["tier-to-delius"]'
- '["unpaid-work-and-delius"]'
- '["workforce-allocations-to-delius"]'
- '["accredited-programmes-and-oasys"]'
# ^ add new projects here
# GitHub Actions doesn't support dynamic choices, we must add each project here to enable manual deployments
# See https://github.com/community/community/discussions/11795
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
- tier-to-delius
- unpaid-work-and-delius
- workforce-allocations-to-delius
- accredited-programmes-and-oasys
# ^ add new projects here
# GitHub Actions doesn't support dynamic choices, we must add each project here to enable manual deployments
# See https://github.com/community/community/discussions/11795
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ on:
- '["tier-to-delius"]'
- '["unpaid-work-and-delius"]'
- '["workforce-allocations-to-delius"]'
- '["accredited-programmes-and-oasys"]'
# ^ add new projects here
# GitHub Actions doesn't support dynamic choices, we must add each project here to enable manual deployments
# See https://github.com/community/community/discussions/11795
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ on:
- '["tier-to-delius"]'
- '["unpaid-work-and-delius"]'
- '["workforce-allocations-to-delius"]'
- '["accredited-programmes-and-oasys"]'
# ^ add new projects here
# GitHub Actions doesn't support dynamic choices, we must add each project here to enable manual deployments
# See https://github.com/community/community/discussions/11795
Expand Down
12 changes: 12 additions & 0 deletions .idea/runConfigurations/accredited_programmes_and_oasys.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions doc/tech-docs/source/services.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ weight: 20
* [Prisoner Profile And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/prisoner-profile-and-delius)
* [Prison Identifier And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/prison-identifier-and-delius)
* [Assessment Summary And Delius](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/assessment-summary-and-delius)
* [Accredited Programmes And Oasys](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/accredited-programmes-and-oasys)
<li style="display: none">^ add new projects here</li>
Empty file.
3 changes: 3 additions & 0 deletions projects/accredited-programmes-and-oasys/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# accredited-programmes-and-oasys

// TODO Describe the service
62 changes: 62 additions & 0 deletions projects/accredited-programmes-and-oasys/applicationinsights.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"role": {
"name": "accredited-programmes-and-oasys"
},
"customDimensions": {
"service.version": "${VERSION}",
"service.team": "probation-integration"
},
"instrumentation": {
"logging": {
"level": "DEBUG"
},
"springScheduling": {
"enabled": false
}
},
"selfDiagnostics": {
"destination": "console"
},
"sampling": {
"percentage": 100
},
"preview": {
"sampling": {
"overrides": [
{
"telemetryType": "request",
"attributes": [
{
"key": "http.url",
"value": "https?://[^/]+/health/?.*",
"matchType": "regexp"
}
],
"percentage": 0
},
{
"telemetryType": "dependency",
"attributes": [
{
"key": "db.statement",
"value": ".*CLIENT_IDENTIFIER.*",
"matchType": "regexp"
}
],
"percentage": 0
},
{
"telemetryType": "dependency",
"attributes": [
{
"key": "db.operation",
"value": "SELECT",
"matchType": "strict"
}
],
"percentage": 10
}
]
}
}
}
31 changes: 31 additions & 0 deletions projects/accredited-programmes-and-oasys/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import uk.gov.justice.digital.hmpps.extensions.ClassPathExtension

apply(plugin = "com.google.cloud.tools.jib")

dependencies {
implementation(project(":libs:commons"))
implementation(project(":libs:oauth-client"))
implementation(project(":libs:oauth-server"))

implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation(libs.springdoc)

dev(project(":libs:dev-tools"))

testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation(libs.bundles.mockito)
}

configure<ClassPathExtension> {
jacocoExclusions = listOf(
"**/config/**",
"**/entity/**",
"**/AppKt.class"
)
}
13 changes: 13 additions & 0 deletions projects/accredited-programmes-and-oasys/deploy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
appVersion: '1.0'
description: A Helm chart for Kubernetes
name: accredited-programmes-and-oasys
version: 1.0.0

dependencies:
- name: generic-service
version: "2.8"
repository: https://ministryofjustice.github.io/hmpps-helm-charts
- name: generic-prometheus-alerts
version: "1.3"
repository: https://ministryofjustice.github.io/hmpps-helm-charts
20 changes: 20 additions & 0 deletions projects/accredited-programmes-and-oasys/deploy/values-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
enabled: false # TODO set this to true when you're ready to deploy your service

generic-service:
ingress:
host: accredited-programmes-and-oasys-dev.hmpps.service.justice.gov.uk

scheduledDowntime:
enabled: true

env:
SENTRY_ENVIRONMENT: dev
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/issuer

INTEGRATIONS_ORDS_URL: https://t2.oasys.service.justice.gov.uk/eor/oasys

LOGGING_LEVEL_UK_GOV_DIGITAL_JUSTICE_HMPPS: DEBUG

generic-prometheus-alerts:
businessHoursOnly: true
18 changes: 18 additions & 0 deletions projects/accredited-programmes-and-oasys/deploy/values-preprod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
enabled: false # TODO set this to true when you're ready to deploy your service

generic-service:
ingress:
host: accredited-programmes-and-oasys-preprod.hmpps.service.justice.gov.uk

scheduledDowntime:
enabled: true

env:
SENTRY_ENVIRONMENT: preprod
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/issuer

INTEGRATIONS_ORDS_OASYS_URL: https://bridge-pp-oasys.az.justice.gov.uk/eor/oasys

generic-prometheus-alerts:
businessHoursOnly: true
12 changes: 12 additions & 0 deletions projects/accredited-programmes-and-oasys/deploy/values-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
enabled: false # TODO set this to true when you're ready to deploy your service

generic-service:
ingress:
host: accredited-programmes-and-oasys.hmpps.service.justice.gov.uk

env:
SENTRY_ENVIRONMENT: prod
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in.hmpps.service.justice.gov.uk/auth/issuer

INTEGRATIONS_ORDS_URL: https://bridge-oasys.az.justice.gov.uk/eor/oasys
20 changes: 20 additions & 0 deletions projects/accredited-programmes-and-oasys/deploy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Common values
generic-service:
nameOverride: accredited-programmes-and-oasys

image:
repository: ghcr.io/ministryofjustice/hmpps-probation-integration-services/accredited-programmes-and-oasys

ingress:
tlsSecretName: accredited-programmes-and-oasys-cert

namespace_secrets:
accredited-programmes-and-oasys-client-credentials:
INTEGRATIONS_ORDS_CLIENT-ID: ORDS_CLIENT_ID
INTEGRATIONS_ORDS_CLIENT-SECRET: ORDS_CLIENT_SECRET
accredited-programmes-and-oasys-sentry:
SENTRY_DSN: SENTRY_DSN

generic-prometheus-alerts:
targetApplication: accredited-programmes-and-oasys

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "accredited-programmes-and-oasys"
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package uk.gov.justice.digital.hmpps

import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT
import org.springframework.boot.test.mock.mockito.MockBean
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
import uk.gov.justice.digital.hmpps.test.MockMvcExtensions.withToken
import uk.gov.justice.digital.hmpps.telemetry.TelemetryService

@AutoConfigureMockMvc
@SpringBootTest(webEnvironment = RANDOM_PORT)
internal class IntegrationTest {
@Autowired
lateinit var mockMvc: MockMvc

@MockBean
lateinit var telemetryService: TelemetryService

@Test
fun `API call retuns a success response`() {
mockMvc
.perform(get("/example/123").withToken())
.andExpect(status().is2xxSuccessful)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package uk.gov.justice.digital.hmpps

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class App

fun main(args: Array<String>) {
runApplication<App>(*args)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package uk.gov.justice.digital.hmpps.controller

import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RestController

@RestController
class ApiController {
@PreAuthorize("hasRole('ROLE_EXAMPLE')")
@GetMapping(value = ["/example/{inputId}"])
fun handle(
@PathVariable("inputId") inputId: String
) {
// TODO Not yet implemented
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Default config
server.shutdown: graceful
spring:
jackson:
default-property-inclusion: non_empty
parser:
allow-unquoted-control-chars: true
security.oauth2.client:
registration:
default:
provider: oasys-ords-auth
authorization-grant-type: client_credentials
client-id: ${integrations.ords.client-id}
client-secret: ${integrations.ords.client-secret}
provider:
oasys-ords-auth:
token-uri: ${integrations.ords.url}/oauth/token
threads.virtual.enabled: true

management:
endpoints.web:
base-path: /
exposure.include: [ "health", "info" ]
endpoint.health.show-details: always

---
# Shared dev/test config
spring.config.activate.on-profile: [ "dev", "integration-test" ]

context.initializer.classes: uk.gov.justice.digital.hmpps.wiremock.WireMockInitialiser

jwt.authorities:
- ROLE_EXAMPLE

integrations:
ords:
url: http://localhost:${wiremock.port}/eor/oasys
client-id: accredited-programmes-and-oasys
client-secret: accredited-programmes-and-oasys

logging.level:
uk.gov.justice.digital.hmpps: DEBUG
org.hibernate.tool.schema: ERROR
org.apache.activemq: WARN
20 changes: 20 additions & 0 deletions projects/accredited-programmes-and-oasys/tech-docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global

# Ignore bundler config
/.bundle

# Ignore the build directory
/build

# Ignore cache
/.sass-cache
/.cache

# Ignore .DS_store file
.DS_Store

Staticfile.auth
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
:remote: https://github.com/alphagov/tech-docs-template.git
:revision: b37e894
12 changes: 12 additions & 0 deletions projects/accredited-programmes-and-oasys/tech-docs/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# If you do not have OpenSSL installed, change
# the following line to use 'http://'
source 'https://rubygems.org'

# For faster file watcher updates on Windows:
gem 'wdm', '~> 0.1.0', platforms: [:mswin, :mingw, :x64_mingw]

# Windows does not come with time zone data
gem 'tzinfo-data', platforms: [:mswin, :mingw, :x64_mingw, :jruby]

# Include the tech docs gem
gem 'govuk_tech_docs'
Loading

0 comments on commit 8e0eb0e

Please sign in to comment.