Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made some slight tweaks to improve readability and use SWE best practices #1

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
43 changes: 40 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
# azureGatewayDiscovery
Demo days code for azure gateway discovery
# Azure Gateway Batch Import
Demo days code for azure gateway discovery.

For addition deatails on this setup, please reach out to James DeLuca for Azure Gaateway configuration and Gabe Ortiz for Code logic.

##Notion Documentaiton Link
## Functionality
Batch import all APIs listed in Azure API Gateway into the RapidAPI Enterprise Hub

## Installation
Run the following command
``` npm i ```

## Setup .env File

Add local .env file with the following variables
```
# Team ID for the Governance Team you have created in Rapid ENT tenent
OWNER_ID=
# REST URL of Platform API in ENT tenent
REST_URL=
# REST HOST of Platform API in ENT tenent
REST_HOST=
# REST API KEY for Platform API in ENT tenent
REST_KEY=
# URL of GQL Platform API in ENT tenent
GQL_URL=
# HOST of GQL Platform API in ENT tenent
GQL_HOST=
# Personal API Key used for GQL Platform API in ENT tenent
GQL_RAPID_IDENTITY_KEY=
# Team API Key used for GQL Platform API in ENT tenent
GQL_RAPID_KEY=
# Name of the Azure Gateway to export APIs from
AZURE_SERVICE_GATEWAY=
# Resource group used for Azure Gateway
AZURE_RESOURCE_GROUP=
# Subscription ID for Azure Gateway
AZURE_SUBSCRIPTION_ID=
# Access key for Azure Gateway
AZURE_SHARED_ACCESS_KEY=
```

## Notion Documentaiton Link
https://www.notion.so/rapidapi/Azure-Gateway-API-Discovery-02f33835a547403284dc28a5aa7b6328
36 changes: 19 additions & 17 deletions azureAPIGatewayIngest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const axios = require("axios")
const FormData = require('form-data');

require('dotenv').config();

var data = ""
var json = ""
Expand All @@ -10,33 +13,32 @@ const apiSpecs = {}
const apiListings = {}

//RapiAPI Rest PAPI Settings
const OWNERID = ''; // Team Number for the Governance Team you will create
const RESTURL = '' // Rest PAPI URL
const RESTHOST = '' // Rest PAPI Host
const RESTKEY = '' // Rest PAPI Key
const OWNERID = process.env.OWNER_ID; // Team Number for the Governance Team you will create
const RESTURL = process.env.REST_URL; // Rest PAPI URL
const RESTHOST = process.env.REST_HOST; // Rest PAPI Host
const RESTKEY = process.env.REST_KEY; // Rest PAPI Key

//Rapid GraphQL PAPI Settings
const GQLHOST = '' // GQL PAPI Host
const GQLURL = '' // GQL PAPI URL
const GQLRAPIDIDENTITYKEY = '' // GQL Personel PAPI Key
const GQLRAPIDKEY = '' // GQL Team PAPI Key
const GQLHOST = process.env.GQL_HOST; // GQL PAPI Host
const GQLURL = process.env.GQL_URL; // GQL PAPI URL
const GQLRAPIDIDENTITYKEY = process.env.GQL_RAPID_IDENTITY_KEY; // GQL Personel PAPI Key
const GQLRAPIDKEY = process.env.GQL_RAPID_KEY; // GQL Team PAPI Key

//Rapid API Listing via form data settings
var FILENAME = ``;
const FormData = require('form-data');

//Azure Settings
const serviceGatway = '' // Set your Azure gateway name as defing
const azureGatewayName = serviceGatway.toLowerCase()
const serviceGatwayApi = serviceGatway+"/apis"
const azureBaseUrl = "https://" + azureGatewayName + ".management.azure-api.net"
const resourceGroup = '' // Set your Azure resource group
const serviceGatway = process.env.AZURE_SERVICE_GATEWAY; // Set your Azure gateway name as defing
const azureGatewayName = serviceGatway.toLowerCase();
const serviceGatwayApi = serviceGatway+"/apis";
const azureBaseUrl = "https://" + azureGatewayName + ".management.azure-api.net";
const resourceGroup = proces.env.AZURE_RESOURCE_GROUP; // Set your Azure resource group
const provider = "Microsoft.ApiManagement"
const azureAPIversion = "2021-12-01-preview"

//Azure Subscription Details
const subscription = '' // Set your Azure subscription id
const sharedAccessKey = '' // Set your Azure SharedAccess Signature
const subscription = process.env.AZURE_SUBSCRIPTION_ID // Set your Azure subscription id
const sharedAccessKey = process.env.AZURE_SHARED_ACCESS_KEY // Set your Azure SharedAccess Signature

//Azure Gateway API Endpoints
const azureAPISpecURL = `${azureBaseUrl}/subscriptions/${subscription}/resourceGroups/${resourceGroup}/providers/${provider}/service/${serviceGatway}/apis/`;
Expand Down Expand Up @@ -254,4 +256,4 @@ async function walle() {
}
}

walle()
walle()