Difference between revisions of "Edge Server Publication"

From Fusion Registry Wiki
Jump to navigation Jump to search
(Generating Edge Content - Status)
(Web Service)
Line 51: Line 51:
  
 
= Web Service =
 
= Web Service =
 +
 +
== Creating and Configuring Environments ==
 +
=== Add Environment ===
 +
{| class="wikitable"
 +
|-
 +
|style="background-color:#eaecf0"|<b>Entry Point</b>|| <b> /ws/secure/edge/addEnvironment</b>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Access</b>|| <span style='color:red'><b>Private</b></span> (admin only)
 +
|-
 +
|style="background-color:#eaecf0"|<b>Http Method</b>|| POST
 +
|-
 +
|style="background-color:#eaecf0"|<b>Content-Type</b>||  application/json
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Format</b>|| application/json
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Statuses</b>|| <p><b>200</b> - Request accepted</p>
 +
<p><b>400</b> - Posted content invalid</p>
 +
<p><b>401</b> - Unauthorized (if access has been restricted)</p>
 +
<p><b>500</b> - Server Error</p>
 +
|}
 +
 +
 +
The POST JSON should look as follows:
 +
{
 +
  "Id" : "EdgeEnvironmentId",
 +
  "Description" : "Environment Description"
 +
}
 +
 +
<p>The Edge Server Environment will be saved, and further web services can be used to configure what is included in the publication file for the Fusion Edge Server</p>
 +
 +
=== Add Environment ===
 +
{| class="wikitable"
 +
|-
 +
|style="background-color:#eaecf0"|<b>Entry Point</b>|| <b> /ws/secure/edge/editEnvironment</b>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Access</b>|| <span style='color:red'><b>Private</b></span> (admin only)
 +
|-
 +
|style="background-color:#eaecf0"|<b>Http Method</b>|| POST
 +
|-
 +
|style="background-color:#eaecf0"|<b>Content-Type</b>||  application/json
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Format</b>|| application/json
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Statuses</b>|| <p><b>200</b> - Request accepted</p>
 +
<p><b>400</b> - Posted content invalid</p>
 +
<p><b>401</b> - Unauthorized (if access has been restricted)</p>
 +
<p><b>500</b> - Server Error</p>
 +
|}
 +
 +
 +
The POST JSON should look as follows:
 +
{
 +
  "Id" : "NewEnvironmentId",
 +
  "OldId"  : "OldEnvironmentId"
 +
  "Description" : "Environment Description"
 +
}
 +
 +
<p>The Edit server allows the Id to be changed, this is optional and is achieved by specifying an OldId which is different to the Id in the POST request.  The description can also be changed.</p>
 +
 +
 +
=== Configure Include Data ===
 +
{| class="wikitable"
 +
|-
 +
|style="background-color:#eaecf0"|<b>Entry Point</b>|| <b> /ws/secure/edge/setIncludeData</b>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Access</b>|| <span style='color:red'><b>Private</b></span> (admin only)
 +
|-
 +
|style="background-color:#eaecf0"|<b>Http Method</b>|| POST
 +
|-
 +
|style="background-color:#eaecf0"|<b>Content-Type</b>||  application/json
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Format</b>|| application/json
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Statuses</b>|| <p><b>200</b> - Request accepted</p>
 +
<p><b>400</b> - Posted content invalid</p>
 +
<p><b>401</b> - Unauthorized (if access has been restricted)</p>
 +
<p><b>500</b> - Server Error</p>
 +
|}
 +
 +
The POST JSON should look as follows:
 +
{
 +
  "Id" : "EnvironmentId",
 +
  "IncludeData"  : true|false
 +
}
 +
 +
<p>
 +
If true then the Edge Server publication will include datasets.  By default the publication will include all datasets that it is has access to, based on security rules and the Environment's linked organisation type.  If the Environment is not linked to a Organisation, then the Environment will be treated as a anonymous (unauthenticated) user, and only datasets with public access will be included in the publication.</p>
 +
<p>
 +
The <b>setIncludedDataflows</b> web service can be used to define an explicit set of datasets that should be included in the publication, with any unspeciufied datasets being implicitly excluded.
 +
</p>
 +
<p>
 +
If false, then the Edge Server publicaiton will not include any datasets
 +
</p>
 +
 +
=== Configure Include Datasets ===
 +
{| class="wikitable"
 +
|-
 +
|style="background-color:#eaecf0"|<b>Entry Point</b>|| <b> /ws/secure/edge/setIncludedDataflows</b>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Access</b>|| <span style='color:red'><b>Private</b></span> (admin only)
 +
|-
 +
|style="background-color:#eaecf0"|<b>Http Method</b>|| POST
 +
|-
 +
|style="background-color:#eaecf0"|<b>Content-Type</b>||  application/json
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Format</b>|| application/json
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Statuses</b>|| <p><b>200</b> - Request accepted</p>
 +
<p><b>400</b> - Posted content invalid</p>
 +
<p><b>401</b> - Unauthorized (if access has been restricted)</p>
 +
<p><b>500</b> - Server Error</p>
 +
|}
 +
 +
The POST JSON should look as follows:
 +
{
 +
  "Id" : "EnvironmentId",
 +
  "IncludeDataflows"  : ["urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=ESTAT:HC01(2.0)", " urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=WB:WDI_HEALTH(1.0)"]
 +
}
 +
 +
<p>
 +
The array of URNs are the URNs of each Dataflow to include data for. 
 +
</p>
  
 
== Generating Edge Content ==
 
== Generating Edge Content ==

Revision as of 02:56, 11 February 2020


Overview

By design, the Fusion Registry does not diretly integrate with the Fusion Edge server, instead it is capable of generating content that can be published to it. The genearted content consists of a single zip file, as required by the Fusion Edge Server for ingestion.

Edge Server 'environments' can be described in the Fusion Registry, the puspose for describing an environment is to enable the Fusion Registry to know what content is should include/exclude from the published content. There is no direct or indirect relationship between the Fusion Registry and the Fusion Edge Server, so the 'environment' definition is simply to help administrators maintain a packaging definition.

The Fusion Registry User Interface supports the creation of an environment definition, and can be used to generate the publication file for the Fusion Edge Server. It is also possible to drive both processes using the Fusion Registry web services.

The process of publishing the generated content to the Fusion Edge server is beyond the remit of the Fusion Registry, and therefore is either a manual process, or an automated task using scripts which are external to, and not goverened by, the Fusion Registry

Environment Definition

The Fusion Edge Server Environment Definition consists of the following properties

Property Purpose
Id Unique Identifier. This is used when performing operations such as changing definitions, or generating a publication
Description Human readable description of the environment
Include Data whether to include datasets in the publication (or structural metadata only) (yes/no/or a specific list)
Include Reference Metadata true/false - whether to include reference metadata in the publication
Include Provisions true/false - related to the inclusion of data, whether to include Provision Agreements in the publication, or just the Dataflows
Edge Organisation optional. This can be set to any Data Provider,Data Consumer, or Agency in the Fusion Registry. When generating content for the Fusion Edge Server, the environment will be treated as a user, with the same security rules applied as if the linked Organisation were requesting structures or data. The default setting is anonymous user.
Enforce Embargo if set to true, then an Embargo date/time must be set when generating the Edge Server content


Generating Edge Content

The generation of Edge content requires the following information

Property Purpose
Publication Type
  • Full Replace - this is the default behaviour. The generated zip file contains the full contents (data/structures/reference metadata) for the Fusion Edge Server. When loading this zip to the Fusion Edge Server all existing content will be replaced.
  • Delta - only relevant for datasets. The generated zip file contains only datasets that have changed since the last publication. Only the data that has been changed will be included. When loading the file to the Fusion Edge Server, all existing content will be preserved, and the new data will be merged into the existing datasets
Embargo Optional. If an embargo time is supplied, this information is put into the zip's file name as a timestamp. The Fusion Edge Server uses the file name to determine if there is an embargo time, and will not publish the environment until the embargo time has passed

The generation of Edge conent is a request which is processed asyncronously, and as such a status report is maintained by the Fusion Registry so that the progress can be tracked. Once the edge content is ready, it can be downloaded via a sererate call.

Download Edge Content

Once the Fusion Registry has generated a Fusion Edge Server publication, it can be downloaded. The download is available up until such time that the Fusion Registry is asked to generate a new Fusion Edge Server publication for the same environment.


Web Service

Creating and Configuring Environments

Add Environment

Entry Point /ws/secure/edge/addEnvironment
Access Private (admin only)
Http Method POST
Content-Type application/json
Response Format application/json
Response Statuses

200 - Request accepted

400 - Posted content invalid

401 - Unauthorized (if access has been restricted)

500 - Server Error


The POST JSON should look as follows:

{
  "Id" : "EdgeEnvironmentId",
  "Description" : "Environment Description"
}

The Edge Server Environment will be saved, and further web services can be used to configure what is included in the publication file for the Fusion Edge Server

Add Environment

Entry Point /ws/secure/edge/editEnvironment
Access Private (admin only)
Http Method POST
Content-Type application/json
Response Format application/json
Response Statuses

200 - Request accepted

400 - Posted content invalid

401 - Unauthorized (if access has been restricted)

500 - Server Error


The POST JSON should look as follows:

{
  "Id" : "NewEnvironmentId",
  "OldId"   : "OldEnvironmentId"
  "Description" : "Environment Description"
}

The Edit server allows the Id to be changed, this is optional and is achieved by specifying an OldId which is different to the Id in the POST request. The description can also be changed.


Configure Include Data

Entry Point /ws/secure/edge/setIncludeData
Access Private (admin only)
Http Method POST
Content-Type application/json
Response Format application/json
Response Statuses

200 - Request accepted

400 - Posted content invalid

401 - Unauthorized (if access has been restricted)

500 - Server Error

The POST JSON should look as follows:

{
  "Id" : "EnvironmentId",
  "IncludeData"   : true|false
}

If true then the Edge Server publication will include datasets. By default the publication will include all datasets that it is has access to, based on security rules and the Environment's linked organisation type. If the Environment is not linked to a Organisation, then the Environment will be treated as a anonymous (unauthenticated) user, and only datasets with public access will be included in the publication.

The setIncludedDataflows web service can be used to define an explicit set of datasets that should be included in the publication, with any unspeciufied datasets being implicitly excluded.

If false, then the Edge Server publicaiton will not include any datasets

Configure Include Datasets

Entry Point /ws/secure/edge/setIncludedDataflows
Access Private (admin only)
Http Method POST
Content-Type application/json
Response Format application/json
Response Statuses

200 - Request accepted

400 - Posted content invalid

401 - Unauthorized (if access has been restricted)

500 - Server Error

The POST JSON should look as follows:

{
  "Id" : "EnvironmentId",
  "IncludeDataflows"   : ["urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=ESTAT:HC01(2.0)", "	urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=WB:WDI_HEALTH(1.0)"]
}

The array of URNs are the URNs of each Dataflow to include data for.

Generating Edge Content

Entry Point /ws/secure/edge/buildEdgeServerPublication
Access Private (admin only)
Http Method POST
Content-Type application/json
Response Format application/json
Response Statuses

200 - Request accepted

400 - Posted content invalid

401 - Unauthorized (if access has been restricted)

500 - Server Error

The POST JSON should look as follows:

{
  "Id" : "EdgeEnvironmentId",
  "PublicationType" : "FullReplace",  
  "EmbargoDate" : 1581353225818,
}

PublicationType of Replace is used to indicate that it is a delta

The Embargo Date is optional, and measured in Epoc Timestamp milliseconds (number of milliseconds since 1970)


Generating Edge Content - Status

Entry Point /environment/status/{environmentID}
Access Private (admin only)
Http Method GET
Response Format application/json
Response Statuses

200 - Request accepted

401 - Unauthorized (if access has been restricted)

500 - Server Error

The reponse looks as follows:

{
 "id" : 1
 "environmentId" : "PROD"
 "processStartDate" : 1581353225818
 "processEndDate" : 1581353233333
 "status" : "PROCESSING"|"ERRORED"|"SUCCESSFUL"|"CANCELLED"|"WRITING_DATA"|"WRITING_STRUCTURES"
 "auditTxId" : "cd82166a-fe31-4870-8307-c0f8d00d3eb3",
 "totalDatasets" : 10,
 "processedDatasets" : 8
 "error" : ""
}


The following table describes the JSON properties in the response message

Property Description
id Unique identifier for this status
environmentId The Id of the environment that the status is for
processStartDate The end date of the Edge Server zip generation process, in epoch time milliseconds
processEndDate The end date of the Edge Server zip generation process, in epoch time milliseconds
status The current status of the Edge Server zip generation
auditTxId The audit transaction id
totalDatasets Total number of datasets that will be included in the output
processedDatasets Total number of datasets that have been written to the output so far
error Optional. Provided if the status is ERRORED.
Example

Downloading Edge Content

Entry Point /environment/export/{environmentID}
Access Private (admin only)
Http Method GET
Response Format application/octet-stream
Response Statuses

200 - Request accepted

401 - Unauthorized (if access has been restricted)

500 - Server Error

A call to this web service results in a file download which can be published to the Fusion Edge Server. The name of the file is important as it is used to tell the Fusion Edge Server what the contents are and how to treat the information. The following table describes the various names the file can take

File Name Description
node.zip Full Replace
node_1581353225818.zip Full Replace with an embargo time of 1581353225818 milliseconds since 1970. This timestamp relates to 10-Feb-2020, 16:47:05 GMT
delta.zip Contains only datasets to be merged with existing datasets in the Fusion Edge Server
delta_1581353225818.zip.zip Contains only datasets to be merged with existing datasets in the Fusion Edge Server - with an embargo time provided of 1581353225818 milliseconds since 1970.