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

Add shared service with external URI #2553

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

FEATURES:
* Added filtering and sorting to Airlock UI ([#2511](https://github.com/microsoft/AzureTRE/issues/2511))
* Added External URI shared service ([#2553](https://github.com/microsoft/AzureTRE/pull/2553))

ENHANCEMENTS:

Expand Down Expand Up @@ -129,7 +130,7 @@ COMPONENTS:

FEATURES:

*
* Add External URI Shared service template ([#2553](https://github.com/microsoft/AzureTRE/pull/2553))

ENHANCEMENTS:

Expand Down
16 changes: 10 additions & 6 deletions api_app/db/repositories/shared_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,17 @@ def get_shared_service_spec_params(self):
def create_shared_service_item(self, shared_service_input: SharedServiceTemplateInCreate, user_roles: List[str]) -> Tuple[SharedService, ResourceTemplate]:
shared_service_id = str(uuid.uuid4())

existing_shared_services = self.query(self.operating_shared_service_with_template_name_query(shared_service_input.templateName))
# for certain shared services, restrict to one instance
multi_instance_allowed = ["tre-shared-service-external-uri"]

# Duplicate is same template (=id), same version and deployed
if existing_shared_services:
if len(existing_shared_services) > 1:
raise InternalError(f"More than one active shared service exists with the same id {shared_service_id}")
raise DuplicateEntity
if shared_service_input.templateName not in multi_instance_allowed:
existing_shared_services = self.query(self.operating_shared_service_with_template_name_query(shared_service_input.templateName))

# Duplicate is same template (=id), same version and deployed
if existing_shared_services:
if len(existing_shared_services) > 1:
raise InternalError(f"More than one active shared service exists with the same id {shared_service_id}")
raise DuplicateEntity

template = self.validate_input_against_template(shared_service_input.templateName, shared_service_input, ResourceType.SharedService, user_roles)

Expand Down
5 changes: 5 additions & 0 deletions docs/tre-templates/shared-services/external_uri.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# External URI Shared Service

This shared service allows a serivce to be added to the TRE UI that solely links to a pre-existing web asset. Ths could be a link to a data catalog, documentation site, or other system.

At time of deploy enter the external URI which will be saved as the `connection_uri` of the resulting shared service.
7 changes: 7 additions & 0 deletions templates/shared_services/external_uri/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Put files here that you don't want copied into your bundle's invocation image
.gitignore
**/.terraform/*
**/.terraform.lock.hcl
**/*_backend.tf
Dockerfile.tmpl
2 changes: 2 additions & 0 deletions templates/shared_services/external_uri/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cnab/
.terraform*
14 changes: 14 additions & 0 deletions templates/shared_services/external_uri/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"schemaVersion": "1.0.0-DRAFT",
"name": "base",
"created": "2021-06-04T13:37:29.5071039+03:00",
"modified": "2021-06-04T13:37:29.5071039+03:00",
"parameters": [
{
"name": "connection_uri",
"source": {
"env": "CONNECTION_URI"
}
}
]
}
48 changes: 48 additions & 0 deletions templates/shared_services/external_uri/porter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: tre-shared-service-external-uri
version: 0.0.4
description: "TRE shared service - External URI"
registry: azuretre

parameters:
- name: connection_uri
type: string
env: CONNECTION_URI
description: "The connection URI for the Azure TRE shared service"

outputs:
- name: connection_uri
type: string
applyTo:
- install
- upgrade

mixins:
- exec

install:
- exec:
description: "Install shared service"
command: echo
arguments:
- "{{ bundle.parameters.connection_uri }}"
outputs:
- name: connection_uri
regex: "(.*)"

upgrade:
- exec:
description: "Upgrade shared service"
command: echo
arguments:
- "{{ bundle.parameters.connection_uri }}"
outputs:
- name: connection_uri
regex: "(.*)"

uninstall:
- exec:
description: "Uninstall shared service"
command: echo
arguments:
- "This shared service does not have anythign to uninstall"
19 changes: 19 additions & 0 deletions templates/shared_services/external_uri/template_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://github.com/microsoft/AzureTRE/templates/shared_services/certs/template_schema.json",
"type": "object",
"title": "External URI",
"description": "Create a shared service that is solely a link to an external URI",
"required": [
"connection_uri"
],
"properties": {
"connection_uri": {
"$id": "#/properties/connection_uri",
"type": "string",
"title": "External URL",
"description": "The external URL for the service",
"updateable": true
}
}
}