Search…
Services
This library was generated with Nx.
The library uses the X-Road Service Metadata and X-Road Service Metadata for REST to collect information about services registered in the X-Road environment.

Running unit tests

Run ng test api-catalogue-services to execute the unit tests via Jest.

Usage

This library export ApiCatalogueServiceModule which depends on two environment variables to exist to configure connection to X-Road Security Server.
The variables are available from AWS Parameter Store under the /k8s/xroad-collector/ path. The variable are named:
  • XROAD_BASE_PATH
  • XROAD_CLIENT_ID

Developing

Codegen

We use codegen to generate clients from the OpenAPI documents for the two REST services X-Road provides for this metadata. In workspace.json we have setup a codegen command:
1
# Generates clients
2
yarn nx run services-xroad-collector:schemas/codegen
Copied!

X-Road Security Server

There are two options while developing this service against X-Road Security Server. Either run a standalone Security Server using Docker:
1
# Publish the container ports (4000, 443 and 80) to localhost (loopback address)
2
# using the latest docker image available. See docker hub for specific tags for specific version.
3
docker run -p 4000:4000 -p 80:80 -p 443:443 --name ss niis/xroad-security-server-standalone
Copied!
Developer can now access Security Server AdminUI on https://localhost:4000 to register custom services and clients for testing.
or connect to Stafrænt Ísland X-Road Dev environment using kubernetes port-forwarding:
1
# Pre-requisite: AWS authentication env params added to the current shell
2
# Get kubernetes namespaces from the dev cluster using AWS
3
aws eks update-kubeconfig --name dev-cluster01 --region eu-west-1
4
5
# Port forward to the kubernetes cluster
6
kubectl -n socat port-forward svc/socat-xroad 8080:80
Copied!
Then to test the commands using curl in cli you can do:
1
# List clients
2
curl -H "Accept: application/json" http://localhost/listClients
3
4
# or when using IS-DEV X-Road environment
5
curl -H "Accept: application/json" http://localhost:8080/listClients
Copied!
1
# List services for specific client
2
curl -H "Accept: application/json" -H "X-Road-Client: CS/ORG/1111/TestService" http://localhost/r1/CS/ORG/1111/TestService/listMethods
3
4
# or when using IS-DEV X-Road environment
5
curl -H "Accept: application/json" -H "X-Road-Client: IS-DEV/GOV/10000/island-is-client" http://localhost:8080/r1/IS-DEV/GOV/10000/island-is-protected/listMethods
Copied!
1
# When using standalone X-Road Security Server and after adding petstore to the
2
# TestService using the AdminUI
3
curl -H "Accept: application/json" -H "X-Road-Client: CS/ORG/1111/TestService" http://localhost/r1/CS/ORG/1111/TestService/getOpenAPI?serviceCode=petstore
4
5
# or when using IS-DEV X-Road environment
6
curl -H "Accept: application/json" -H "X-Road-Client: IS-DEV/GOV/10000/island-is-client" http://localhost:8080/r1/IS-DEV/GOV/10000/island-is-protected/getOpenAPI?serviceCode=petstore-v1
Copied!
NIIS X-Road Playground is available at:
Last modified 1yr ago