npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@adityasinghal26/plugin-oracle-cloud-backend

v0.3.0

Published

A backend plugin implementation to connect to the Oracle Cloud API.

Downloads

48

Readme

Oracle Cloud Backend Plugin

A backend plugin implementation to connect to the Oracle Cloud API.

Setup into a Backstage Instance

The plugin needs to be configured and then installed as per the steps in following section.

Configuration

The Oracle Cloud plugin allows either single or multiple Oracle Cloud tenancies, allowing to trigger REST APIs with the tenancy and profile name. The tenancy name (tenancyName) and the profile name (profile) in the API query parameters is optional, which if not provided, will utilise the default tenancy and the profile in the configuration.

Oracle Configuration File

Below is a sample reference for Oracle configuration file. Here, the profile name is in square brackets '[]' and other details such as user ID, tenancy ID and region can be configured. You will also need to provide a path to your private PEM file for authentication.

Note: It is advised to create one config file for each tenancy where different profiles such as DEFAULT, and test (in this example) can be configured with different users and regions.

[DEFAULT]
user=ocid1.user.oc1..<your_unique_id>
fingerprint=<your_fingerprint>
tenancy=ocid1.tenancy.oc1..<your_unique_id>
region=<your_region>
key_file=~/.oci/oci_api_key.pem

[test]
user=ocid1.user.oc1..<your_unique_id_test>
fingerprint=<your_fingerprint_test>
tenancy=ocid1.tenancy.oc1..<your_unique_id>
region=<your_region>
key_file=~/.oci/oci_api_key.pem

Single Configuration

oracleCloud:
  configFilePath: ./config
  defaultProfile: test

Multiple Configurations

oracleCloud:
  configFilePath: ./config
  defaultProfile: test
  tenancies:
  - tenancyName: companyA
    configFilePath: ./configA
    defaultProfile: profileA1
  - tenancyName: companyB
    configFilePath: ./configB
    defaultProfile: profileB1

Sample API to get tenancy details based on tenancy and profile configurations

If the query parameters tenancyName and profile are omitted or left empty, the plugin will consider the default values for both tenancy and profile configuration.

curl --location 'http://localhost:7007/api/oracle-cloud/identity/tenancy?tenancyName=companyA&profile=profileA1'

Up and Running

Follow the below steps and integrate Oracle Cloud Backend plugin into your Backstage instance.

  1. First we need to add the @backstage/plugin-oracle-cloud-backend package to your backend:

    # From your Backstage root directory
    yarn add --cwd packages/backend @adityasinghal26/plugin-oracle-cloud-backend
  2. Then we will create a new file named packages/backend/src/plugins/oracle-cloud.ts, and add the following to it:

    import { createRouter } from '@adityasinghal26/plugin-oracle-cloud-backend';
    import { Router } from 'express';
    import type { PluginEnvironment } from '../types';
    
    export default function createPlugin(
      env: PluginEnvironment,
    ): Promise<Router> {
      return createRouter({
        logger: env.logger,
        config: env.config,
      });
    }
  3. Next we wire this into the overall backend router, edit packages/backend/src/index.ts:

    import oracleCloud from './plugins/oracle-cloud';
    // ...
    async function main() {
      // ...
      // Add this line under the other lines that follow the useHotMemoize pattern
      const oracleEnv = useHotMemoize(module, () => createEnv('oracleCloud'));
      // ...
      // Insert this line under the other lines that add their routers to apiRouter in the same way
      apiRouter.use('/oracle-cloud', await oracleCloud(oracleEnv));
  4. Now run yarn start-backend from the repo root

  5. Finally open http://localhost:7007/api/oracle-cloud/health in a browser/or from Postman and it should return {"status":"ok"}

New Backend System

The Oracle Cloud Backend plugin does not support the new backend system currently. The plugin will be extended to support the same in upcoming versions.