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

multi-cloud-provisioning-tools

v1.0.0

Published

This library aims to provide data on infrastructure across multiple cloud providers. Currently, it supports Azure and vSphere.

Downloads

9

Readme

Welcome!

The aim of this library is to provide you with tools to help provision clusters using multiple infrastructure providers.

Right now the library supports vSphere and Azure.

Install

npm i multi-cloud-provisioning-tools

Examples

Import

import { vSphereClient, AzureClient, Cluster, DataCenter } from "multi-cloud-provisioning-tools";

Azure

  const subscriptionId = 'YOUR_SUBSCRIPTION_ID';
  const clientId = 'YOUR_CLIENT_ID';
  const clientSecret = 'YOUR_CLIENT_SECRET';
  const tenantId = 'YOUR_TENANT_ID';

  const client = new AzureClient(subscriptionId);

  // Authenticate with a client secret
  await client.authenticate(clientId, clientSecret, tenantId);

  // List all locations
  const locations = await client.getLocations();
  console.log('Locations:', locations);

  // List all resource SKUs
  const allSkus = await client.getResourceSkus();
  console.log('Resource SKUs:', allSkus);

  // List all resource SKUs in a specific location
  const location = 'eastus';
  const locationSkus = await client.getResourceSkus(location);
  console.log(`Resource SKUs in ${location}:`, locationSkus);

  // List all virtual machine sizes in a specific location
  const vmSizes = await client.getVirtualMachineSizes(location);
  console.log(`Virtual machine sizes in ${location}:`, vmSizes);

  // List all resource SKUs for a specific resource type
  const resourceType = 'virtualMachines';
  const typeSkus = await client.getResourceSkus(undefined, resourceType);
  console.log(`Resource SKUs for ${resourceType}:`, typeSkus);

  // List all resource SKUs for a specific virtual machine size
  const vmSize = 'Standard_DS2_v2';
  const vmSkus = await client.getResourceSkus(undefined, undefined, vmSize);
  console.log(`Resource SKUs for ${vmSize}:`, vmSkus);

  // List all resource SKUs for a specific location, resource type, and virtual machine size
  const specificSkus = await client.getResourceSkus(
    location,
    resourceType,
    vmSize
  );
  console.log(
    `Resource SKUs for ${location}, ${resourceType}, and ${vmSize}:`,
    specificSkus
  );

vSphere

  const host = 'your-vsphere-host';
  const username = 'your-username';
  const password = 'your-password';

  const client = new vSphereClient(host, username, password, false);
  await client.authenticate();

  // Fetch VMs
  const allVMs = await client.getVMs();
  console.log('All Virtual Machines:', allVMs);
  const filteredVMs = await client.getVMs({ names: ['vm1', 'vm2'] });
  console.log('Filtered Virtual Machines:', filteredVMs);

  // Fetch Clusters
  const allClusters = await client.getClusters();
  console.log('All Clusters:', allClusters);
  const filteredClusters = await client.getClusters({
    clusters: ['cluster1-id'],
  });
  console.log('Filtered Clusters:', filteredClusters);

  // Fetch Datacenters
  const allDatacenters = await client.getDataCenters();
  console.log('All Datacenters:', allDatacenters);
  const filteredDatacenters = await client.getDataCenters({
    names: ['dc1-id'],
  });
  console.log('Filtered Datacenters:', filteredDatacenters);

  // Fetch Datastores
  const allDatastores = await client.getDatastores();
  console.log('All Datastores:', allDatastores);
  const filteredDatastores = await client.getDatastores({ types: ['VMFS'] });
  console.log('Filtered Datastores:', filteredDatastores);

  // Fetch Folders
  const allFolders = await client.getFolders();
  console.log('All Folders:', allFolders);
  const filteredFolders = await client.getFolders({ folders: ['folder-name'] });
  console.log('Filtered Folders:', filteredFolders);

  // Fetch Deployments
  const allDeployments = await client.getDeployments();
  console.log('All Deployments:', allDeployments);

  // Fetch Hosts
  const allHosts = await client.getHosts();
  console.log('All Hosts:', allHosts);
  const filteredHosts = await client.getHosts({ datacenters: ['center-name'] });
  console.log('Filtered Hosts:', filteredHosts);

  // Fetch Networks
  const allNetworks = await client.getNetworks();
  console.log('All Networks:', allNetworks);
  const filteredNetworks = await client.getNetworks({
    types: [NetworkType.DISTRIBUTED_PORTGROUP],
  });
  console.log('Filtered Networks:', filteredNetworks);

  // Fetch Resource Pools
  const allResourcePools = await client.getResourcePools();
  console.log('All Resource Pools:', allResourcePools);
  const filteredResourcePools = await client.getResourcePools({
    datacenters: ['dat-center-name'],
  });
  console.log('Filtered Resource Pools:', filteredResourcePools);

Built with Rollup Typescript Boilerplate

https://github.com/xg4/rollup-typescript-boilerplate

LICENSE

MIT