GithubHelp home page GithubHelp logo

yunionio / mcclient_nodejs Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 1.0 26 KB

Nodejs SDK for Cloudpods API

License: Apache License 2.0

JavaScript 100.00%
nodejs sdk cloudpods multicloud hybridcloud api

mcclient_nodejs's Introduction

Nodejs SDK for Cloudpods API

This repository provides Nodejs SDK for Cloudpods API.

Based on the SDK, a simple nodejs version of climc was implemented as a usage example of SDK.

Setup

npm install

run climc of nodejs version

./bin/climc server-list

use SDK in your nodejs program

  const client = require('mcclient/client');
  let cli = new client.Client(os_auth_url, timeout, debug);

  cli.auth(os_username, os_password, os_domain, os_project_id, os_project_name, os_project_domain)
    .then((token) => {
       let s = cli.session(os_region_name, os_zone_name, os_endpoint_type, token, api_version);
       s.module("servers").list({limit: 100})
         .then((result) => {
             const misc = require("mcclient/misc");        
             misc.printList(result, cli.module('servers').columns());
           })
    }).catch((err) => {
      console.error("Invalid credential:" + err);
    });

Note: nodejs version of mcclient is experimental, you are welcome to contribe to make it complete

mcclient_nodejs's People

Contributors

swordqiu avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

swordqiu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.