# ROCKIT Edge - Admin API

# Introduction
The ROCKIT Edge is the top-level cloud service of ROCKITPLAY which will act as an interface to the its ROCKIT Engine subsystem. In particular, the ROCKIT Edge provides RESTAPI endpoints to
- upload native game builds, which will be automatically converted to ROCKIT images using the ROCKIT Engine.
- publish the resulting ROCKIT Images obtained from the ROCKIT Engine to one or many origins / CDNs.
- Authenticate CDN download URLs to the ROCKIT Images.

Once the ROCKIT Edge has been configured along with its subsystems ROCKIT Engine and ROCKIT Session Manager it is not necessary anymore to invoke the subsystems API as they will be managed by the ROCKIT Edge.ens for each administrator user.

# Generating Administrator Tokens
All administrator endpoints necessary to manage the ROCKIT Edge instance such as
- creation or destruction of organizations and
- purging of existing apps

require an administrator token in the request header, i.e., x-rockit-admin-token. The administrator token grants access to the management endpoints of the ROCKIT Edge. Furthermore, it encodes a string identifying the user who invoked the endpoint which will show up in the corresponding log and notification entries. Therefore, for every administrator an individual administrator token should be created.

A new administrator token can be generated using the script gen-admin-token.sh which is shipped along with the Terraform scripts:

`edge/gen-admin-token "<secret_b64>" "<username>"`



The argument `secret_b64` can be obtained from the OCI vault `rockitplay-vault`. In the vault, navigate to "Secrets" and select the compartment `edge-comp-{workspace}`. Identify the secret `EDGE_ADMIN_SECRET_{WORKSPACE}`.`{RANDOM_INSTANCE_ID}` and copy its base64 encoded content.
The second argument (`username`) in the `gen-admin-token.sh` command line is any meaningful identifier of the ROCKIT Edge administrator such as `John Doe` or `johndoe@example.com`.
The generated administrator token should be shared with the ROCKIT Edge administrator user(s) and will be referred to as `EDGE_ADMIN_TOKEN_{WORKSPACE}` below.

