-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
675 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@REM Capture the content (incl. pages, media files, configuration, etc.) of API Management developer portal into ./dist/snapshot folder. | ||
@REM @REM Make sure you're logged-in with `az login` command before running the script. | ||
|
||
node ./capture ^ | ||
--subscriptionId "< your subscription ID >" ^ | ||
--resourceGroupName "< your resource group name >" ^ | ||
--serviceName "< your service name >" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* This script automates capturing the content of API Management developer portals into snapshot. | ||
* In order to run it, you need to: | ||
* | ||
* 1) Clone the api-management-developer-portal repository: | ||
* git clone https://github.com/Azure/api-management-developer-portal.git | ||
* | ||
* 2) Install NPM packages: | ||
* npm install | ||
* | ||
* 3) Run this script with a valid combination of arguments: | ||
* node ./capture ^ | ||
* --sourceSubscriptionId "< your subscription ID >" ^ | ||
* --sourceResourceGroupName "< your resource group name >" ^ | ||
* --sourceServiceName "< your service name >" ^ | ||
* --destSubscriptionId "< your subscription ID >" ^ | ||
* --destResourceGroupName "< your resource group name >" ^ | ||
* --destServiceName "< your service name >" | ||
*/ | ||
|
||
const { ImporterExporter } = require("./utils"); | ||
|
||
const yargs = require('yargs') | ||
.example(`node ./capture ^ \r | ||
--subscriptionId "< your subscription ID >" ^ \r | ||
--resourceGroupName "< your resource group name >" ^ \r | ||
--serviceName "< your service name >"\n`) | ||
.option('subscriptionId', { | ||
type: 'string', | ||
description: 'Azure subscription ID.', | ||
demandOption: true | ||
}) | ||
.option('resourceGroupName', { | ||
type: 'string', | ||
description: 'Azure resource group name.', | ||
demandOption: true | ||
}) | ||
.option('serviceName', { | ||
type: 'string', | ||
description: 'API Management service name.', | ||
demandOption: true | ||
}) | ||
.help() | ||
.argv; | ||
|
||
async function capture() { | ||
const importerExporter = new ImporterExporter( | ||
yargs.subscriptionId, | ||
yargs.resourceGroupName, | ||
yargs.serviceName | ||
); | ||
|
||
await importerExporter.export(); | ||
|
||
console.log(`The content captured in "./dist/snapshot" folder.`); | ||
} | ||
|
||
capture() | ||
.then(() => { | ||
console.log("DONE"); | ||
process.exit(0); | ||
}) | ||
.catch(error => { | ||
console.error(error); | ||
process.exit(1); | ||
}); | ||
|
||
|
||
module.exports = { | ||
capture | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@REM Delete the content (incl. pages, media files, configuration, etc.) of API Management developer portal. | ||
@REM Make sure you're logged-in with `az login` command before running the script. | ||
|
||
node ./cleanup ^ | ||
--subscriptionId "< your subscription ID >" ^ | ||
--resourceGroupName "< your resource group name >" ^ | ||
--serviceName "< your service name >" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* This script automates deleting the content of API Management developer portals. | ||
* In order to run it, you need to: | ||
* | ||
* 1) Clone the api-management-developer-portal repository: | ||
* git clone https://github.com/Azure/api-management-developer-portal.git | ||
* | ||
* 2) Install NPM packages: | ||
* npm install | ||
* | ||
* 3) Run this script with a valid combination of arguments: | ||
* node ./cleanup ^ | ||
* --sourceSubscriptionId "< your subscription ID >" ^ | ||
* --sourceResourceGroupName "< your resource group name >" ^ | ||
* --sourceServiceName "< your service name >" ^ | ||
* --destSubscriptionId "< your subscription ID >" ^ | ||
* --destResourceGroupName "< your resource group name >" ^ | ||
* --destServiceName "< your service name >" | ||
*/ | ||
|
||
const { ImporterExporter } = require("./utils"); | ||
|
||
const yargs = require('yargs') | ||
.example(`node ./cleanup ^ \r | ||
--subscriptionId "< your subscription ID >" ^ \r | ||
--resourceGroupName "< your resource group name >" ^ \r | ||
--serviceName "< your service name >"\n`) | ||
.option('subscriptionId', { | ||
type: 'string', | ||
description: 'Azure subscription ID.', | ||
example: '<bla bla>', | ||
demandOption: true | ||
}) | ||
.option('resourceGroupName', { | ||
type: 'string', | ||
description: 'Azure resource group name.' | ||
}) | ||
.option('serviceName', { | ||
type: 'string', | ||
description: 'API Management service name.', | ||
}) | ||
.help() | ||
.argv; | ||
|
||
async function cleanup() { | ||
const importerExporter = new ImporterExporter( | ||
yargs.subscriptionId, | ||
yargs.resourceGroupName, | ||
yargs.serviceName | ||
); | ||
|
||
await importerExporter.cleanup(); | ||
} | ||
|
||
cleanup() | ||
.then(() => { | ||
console.log("DONE"); | ||
process.exit(0); | ||
}) | ||
.catch(error => { | ||
console.error(error); | ||
process.exit(1); | ||
}); | ||
|
||
module.exports = { | ||
cleanup | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@REM Generate content (incl. pages, media files, configuration, etc.) of API Management developer portal from ./dist/snapshot folder. | ||
@REM Make sure you're logged-in with `az login` command before running the script. | ||
|
||
node ./generate ^ | ||
--subscriptionId "< your subscription ID >" ^ | ||
--resourceGroupName "< your resource group name >" ^ | ||
--serviceName "< your service name >" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* This script automates generating the content of API Management developer portals from the snapshot. | ||
* In order to run it, you need to: | ||
* | ||
* 1) Clone the api-management-developer-portal repository: | ||
* git clone https://github.com/Azure/api-management-developer-portal.git | ||
* | ||
* 2) Install NPM packages: | ||
* npm install | ||
* | ||
* 3) Run this script with a valid combination of arguments: | ||
* node ./cleanup ^ | ||
* --sourceSubscriptionId "< your subscription ID >" ^ | ||
* --sourceResourceGroupName "< your resource group name >" ^ | ||
* --sourceServiceName "< your service name >" ^ | ||
* --destSubscriptionId "< your subscription ID >" ^ | ||
* --destResourceGroupName "< your resource group name >" ^ | ||
* --destServiceName "< your service name >" | ||
*/ | ||
|
||
const { ImporterExporter } = require("./utils"); | ||
|
||
const yargs = require('yargs') | ||
.example(`node ./generate ^ \r | ||
--subscriptionId "< your subscription ID >" ^ \r | ||
--resourceGroupName "< your resource group name >" ^ \r | ||
--serviceName "< your service name >"\n`) | ||
.option('subscriptionId', { | ||
type: 'string', | ||
description: 'Azure subscription ID.', | ||
demandOption: true | ||
}) | ||
.option('resourceGroupName', { | ||
type: 'string', | ||
description: 'Azure resource group name.', | ||
demandOption: true | ||
}) | ||
.option('serviceName', { | ||
type: 'string', | ||
description: 'API Management service name.', | ||
demandOption: true | ||
}) | ||
.help() | ||
.argv; | ||
|
||
async function generate() { | ||
const importerExporter = new ImporterExporter( | ||
yargs.subscriptionId, | ||
yargs.resourceGroupName, | ||
yargs.serviceName | ||
); | ||
|
||
await importerExporter.import(); | ||
} | ||
|
||
generate() | ||
.then(() => { | ||
console.log("DONE"); | ||
process.exit(0); | ||
}) | ||
.catch(error => { | ||
console.error(error); | ||
process.exit(1); | ||
}); | ||
|
||
|
||
module.exports = { | ||
generate | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Generate and provision default content of an API Management portal - incl. pages, layouts, configuration, media files, etc. | ||
# Make sure you're logged-in with `az login` command before running the script. | ||
|
||
node ./generate \ | ||
--subscriptionId "< your subscription ID >" \ | ||
--resourceGroupName "< your resource group name >" \ | ||
--serviceName "< your service name >" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@REM This script automates content migration between developer portal instances. | ||
@REM Make sure you're logged-in with `az login` command before running the script. | ||
|
||
node ./migrate ^ | ||
--sourceSubscriptionId "< your subscription ID >" ^ | ||
--sourceResourceGroupName "< your resource group name >" ^ | ||
--sourceServiceName "< your service name >" ^ | ||
--destSubscriptionId "< your subscription ID >" ^ | ||
--destResourceGroupName "< your resource group name >" ^ | ||
--destServiceName "< your service name >" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/** | ||
* This script automates deployments between developer portal instances. | ||
* In order to run it, you need to: | ||
* | ||
* 1) Clone the api-management-developer-portal repository: | ||
* git clone https://github.com/Azure/api-management-developer-portal.git | ||
* | ||
* 2) Install NPM packages: | ||
* npm install | ||
* | ||
* 3) Run this script with a valid combination of arguments: | ||
* node ./migrate ^ | ||
* --sourceSubscriptionId "< your subscription ID >" ^ | ||
* --sourceResourceGroupName "< your resource group name >" ^ | ||
* --sourceServiceName "< your service name >" ^ | ||
* --destSubscriptionId "< your subscription ID >" ^ | ||
* --destResourceGroupName "< your resource group name >" ^ | ||
* --destServiceName "< your service name >" | ||
* | ||
* Auto-publishing is not supported for self-hosted versions, so make sure you publish the portal (for example, locally) | ||
* and upload the generated static files to your hosting after the migration is completed. | ||
* | ||
* You can specify the SAS tokens directly (via sourceToken and destToken), or you can supply an identifier and key, | ||
* and the script will generate tokens that expire in 1 hour. (via sourceId, sourceKey, destId, destKey) | ||
*/ | ||
|
||
const { ImporterExporter } = require('./utils.js'); | ||
|
||
const yargs = require('yargs') | ||
.example(`node ./migrate ^ \r | ||
--sourceSubscriptionId "< your subscription ID > ^ \r | ||
--sourceResourceGroupName "< your resource group name >" ^ \r | ||
--sourceServiceName "< your service name >" ^ \r | ||
--destSubscriptionId "< your subscription ID >" ^ \r | ||
--destResourceGroupName "< your resource group name >" ^ \r | ||
--destServiceName "< your service name >"\n`) | ||
.option('sourceSubscriptionId', { | ||
type: 'string', | ||
description: 'Azure subscription ID.', | ||
demandOption: true | ||
}) | ||
.option('sourceResourceGroupName', { | ||
type: 'string', | ||
description: 'Azure resource group name.', | ||
demandOption: true | ||
}) | ||
.option('sourceServiceName', { | ||
type: 'string', | ||
description: 'API Management service name.', | ||
demandOption: true | ||
}) | ||
.option('destSubscriptionId', { | ||
type: 'string', | ||
description: 'Azure subscription ID.', | ||
demandOption: true | ||
}) | ||
.option('destResourceGroupName', { | ||
type: 'string', | ||
description: 'Azure resource group name.', | ||
demandOption: true | ||
}) | ||
.option('destServiceName', { | ||
type: 'string', | ||
description: 'API Management service name.', | ||
demandOption: true | ||
}) | ||
.help() | ||
.argv; | ||
|
||
async function migrate() { | ||
const sourceImporterExporter = new ImporterExporter(yargs.sourceSubscriptionId, yargs.sourceResourceGroupName, yargs.sourceServiceName); | ||
await sourceImporterExporter.export(); | ||
|
||
const destIimporterExporter = new ImporterExporter(yargs.destSubscriptionId, yargs.destResourceGroupName, yargs.destServiceName); | ||
await destIimporterExporter.cleanup(); | ||
await destIimporterExporter.import(); | ||
|
||
/* New publishing endpoint is not deployed to production yet. */ | ||
// await destIimporterExporter.publish(); | ||
} | ||
|
||
migrate() | ||
.then(() => { | ||
console.log("DONE"); | ||
process.exit(0); | ||
}) | ||
.catch(error => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.