0.6.1 • Published 7 years ago

openshift-rest-client-jc v0.6.1

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
7 years ago

Build Status Coverage Status

Openshift Client

Greenkeeper badge

Node.js based client for the Openshift REST API, not unlike the Fabric8 Maven Plugin, but for node clients/builds.

Usage

npm install --save openshift-rest-client

The client needs to be passed a config object with the follow properties:

{ apiVersion: 'v1',
context:
 { cluster: '192-168-99-100:8443',
   namespace: 'for-node-client-testing',
   user: 'developer/192-168-99-100:8443' },
user: { token: 'zVBd1ZFeJqEAILJgimm4-gZJauaw3PW4EVqV_peEZ3U' },
cluster: 'https://192.168.99.100:8443' }

This can be obtained using the openshift-config-loader

By default, the config loader with look for a config at ~/.kube/config

Code:

const openshiftConfigLoader = require('openshift-config-loader');
const openshiftRestClient = require('openshift-rest-client');

openshiftConfigLoader(settings).then((config) => {
  openshiftRestClient(config).then((client) => {
    // Use the client object to find a list of projects, for example
    client.projects.find().then((projects) => {
      console.log(projects);
    });
  });
});