Skip to main content

server-to-cloud-migration-helper

What is this repository for?

Helper class for managing server to cloud related tasks such as fetching data and URLs for migration.

Installation

npm i @appfire/server-to-cloud-migration-helper

Features

  • Handle data retrieval for migration purposes. This class contains three methods:

  • getRetrievedExportList: Retrieves a list of exported data related to a specific transfer ID.

  • getRetrieveSignedUrls: Uses the exported data to fetch signed URLs for migration.

  • getDataFromSignedUrls: Retrieves actual migration data from the signed URLs.

Usage

Importing the server-to-cloud-migration-helper

import { ServerToCloudMigrationHelper } from '@appfire/server-to-cloud-migration-helper';

NodeJS

export const handler = async (
_event: AuthAPIGatewayEvent,
_context: Context
): Promise<APIGatewayProxyResult> => {
if (_event.body) {
const data = JSON.parse(_event.body);
_event.headers.appKey = 'appKey';
if (data.eventType === 'app-data-uploaded') {
const s3keys = await ServerToCloudMigrationHelper.getRetrievedExportList(
_event,
data.transferId
);
const signedUrls =
await ServerToCloudMigrationHelper.getRetrieveSignedUrls(
_event,
s3keys.data
);
const resData = await ServerToCloudMigrationHelper.getDataFromSignedUrls(
signedUrls
);

// send status
await ServerToCloudMigrationHelper.sendAppMigrationStatus(
event,
transferId,
{
status: 'IN_PROGRESS',
percent: 50,
message: 'in progress',
}
);
}
}
};

Sending Migration Status

await MigrationHelper.sendAppMigrationStatus(event, transferId, status);

Valid status values: `IN_PROGRESS`, `SUCCESS`, `FAILED`, `INCOMPLETE`

Configure appKey

  • appKey: Indicates the application key, example org.swift.confluence.refapp

Contribution guidelines

  • Writing tests
  • Based on type of changes (Major, Minor, and Patch) use changeset to update package versions. for more information please check here

Who do I talk to?