diff --git a/CHANGELOG.md b/CHANGELOG.md index e49cbc7e96..ed87c09bda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: @@ -129,7 +130,7 @@ COMPONENTS: FEATURES: -* +* Add External URI Shared service template ([#2553](https://github.com/microsoft/AzureTRE/pull/2553)) ENHANCEMENTS: diff --git a/api_app/db/repositories/shared_services.py b/api_app/db/repositories/shared_services.py index 84da400597..cf5bb2a59c 100644 --- a/api_app/db/repositories/shared_services.py +++ b/api_app/db/repositories/shared_services.py @@ -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) diff --git a/docs/tre-templates/shared-services/external_uri.md b/docs/tre-templates/shared-services/external_uri.md new file mode 100644 index 0000000000..09f8d44806 --- /dev/null +++ b/docs/tre-templates/shared-services/external_uri.md @@ -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. diff --git a/templates/shared_services/external_uri/.dockerignore b/templates/shared_services/external_uri/.dockerignore new file mode 100644 index 0000000000..852f29463e --- /dev/null +++ b/templates/shared_services/external_uri/.dockerignore @@ -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 diff --git a/templates/shared_services/external_uri/.gitignore b/templates/shared_services/external_uri/.gitignore new file mode 100644 index 0000000000..73a68e4976 --- /dev/null +++ b/templates/shared_services/external_uri/.gitignore @@ -0,0 +1,2 @@ +.cnab/ +.terraform* diff --git a/templates/shared_services/external_uri/parameters.json b/templates/shared_services/external_uri/parameters.json new file mode 100755 index 0000000000..d657c0bbce --- /dev/null +++ b/templates/shared_services/external_uri/parameters.json @@ -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" + } + } + ] +} diff --git a/templates/shared_services/external_uri/porter.yaml b/templates/shared_services/external_uri/porter.yaml new file mode 100755 index 0000000000..7724bc9925 --- /dev/null +++ b/templates/shared_services/external_uri/porter.yaml @@ -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" diff --git a/templates/shared_services/external_uri/template_schema.json b/templates/shared_services/external_uri/template_schema.json new file mode 100644 index 0000000000..315332fd8d --- /dev/null +++ b/templates/shared_services/external_uri/template_schema.json @@ -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 + } + } +}