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

@netzreich/openstack-clients

v1.1.6

Published

Openstack Client generated via OpenAPI Spec via openapi-generator

Downloads

419

Readme

OpenStack Clients

This package offers typed OpenStack Clients based on OpenAPI Specs generated by using the official OpenStack projects openapi spec exports.

Installation

To install the OpenStack Clients package, follow these steps:

Install via npm/yarn

npm i @netzreich/openstack-clients
yarn add @netzreich/openstack-clients

Supported APIs

Identity

  • Auth
  • Roles
  • Users
  • Groups
  • Projects
  • Domains
  • Services
  • Endpoints

Compute

  • Extensions
  • OsSimpleTenantUsage
  • Servers
  • Flavours
  • Images
  • OsKeypairs

Network

  • Networks
  • Subnets
  • Ports
  • SecurityGroups
  • SecurityGroupsRules
  • FloatingipPool

Missing an API? More APIs are available but not yet boostrapt in the Client.

Usage

To use the OpenStack Clients package, you can import the desired client module and start making API calls. Here's an example: For most API endpoints you have to authenticate via username/password or application credentials using the authenticate method. Authentication will load the current service-catalog and apply the endpoints to the different clients via service discovery. Only the Keystone has to be configured in the initial config.

Import as ES Module

import OpenStack, { Identity } from "@netzreich/openstack-clients";
import { AxiosError, AxiosResponse } from "axios";
import * as util from "util";

const config = new Identity.Configuration({
  basePath: "{{KEYSTONE_URL}}",

  baseOptions: {
    headers: {
      "Content-Type": "application/json",
    },
  },
});

const client = new OpenStack(
  config,
  auth: {
    identity: {
      methods: ["password"],
      password: {
        user: {
          name: "{{USERNAME}}",
          domain: { name: "{{DOMAINNAME}}" },
          password: "{{PASSWORD}}",
        },
      },
    },
    scope: {
      project: {
        id: "{{PROJECT_ID}}",
        domain: { name: "{{DOMAINNAME}}" },
      },
    },
  },
  mylogger // should implement LoggerInterface
);
client
  .authenticate( // this is all default
    undefined, //this re-uses the creds from before
    true,
    60 * 1000,
    1000
  ) // this will re-auth 5 minutes before token expires and retry auth if auth fails or targets timeouts after 1s
  .then(() => {
    console.log("Authenticated")
    client.Compute.serversGet()
      .then((res: AxiosResponse) => {
        console.log(res.data);
      })
      .catch((err: AxiosError) => {
       console.error(`Failed to get servers: ${err.message}`);
      });
  })
  .catch((err) => {
    console.error(`Authentication failed: ${err.message}`);
  });

You are in need of an OpenCloud under EU law?

This package was developed and tested on the TelemaxX OpenCloud (based on OpenStack)

Contributing

This package is developed on github: https://github.com/NetzreichGmbH/openstack-clients. You can report issues and make pull-requests.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Get Support

As experts in digital solutions, netzreich supports you in the implementation and management of OpenStack services. Our experienced team offers comprehensive consulting and tailored solutions for cloud computing and OpenStack architectures. Whether it's API integration, cloud infrastructure, or specific applications – we help you future-proof your IT infrastructure. Contact us for professional advice and customized solutions.