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

bluemix-client

v0.0.12

Published

Client for Bluemix CloudFoundry API and Container API. Initial idea based on https://www.npmjs.com/package/cf-nodejs-client (that is full featured), this is under construction

Downloads

5

Readme

Bluemix client

The client idea is based in cf-nodejs-client but I don't need some parts and I wanted to play a little with Bluemix API and Node.js.

Also, I need access to Container API and the cf client doesn't provide it, for now.

Install

	npm install bluemix-client --save

Basic usage

	var bluemix = require("bluemix-client").Bluemix;
	bluemix = new bluemix();

	bluemix.login("username","password")

	.then(function(state){
		if(state==="logged"){
			
	      bluemix.spaces().get({region : req.params.region, params : req.query}) //you can pass pagination info
	      .then(
	        function(data){
	            console.log(data)
	        }
	      )  
	      .catch(function (reason) {
	            console.log(reason);
	      });
	      
	      //bluemix.services().get({})
	      //bluemix.containers().get({})
	      bluemix.apps().get({space_guid : req.params.space, region : req.params.region, params : req.query})
	      .then(
	        function(data){
	            console.log(data)
	        }
	      )  
	      .catch(function (reason) {
	            console.log(reason);
	      });

		}else{
			//...
		}
	})

	.catch(function(error){
		//...
	});

Notes

  • If you implement a REST API with this client, you can forget about refresh token when it expires: the client does it automatically

Methods

  • .organizations()

    • .getAll({region})
  • .spaces()

    • .getAll({region[, organization_guid][, params : {param:value}]})
    • .get({region, space_guid[, params : {param:value}]})
    • .create({region, form : {organization_guid, name}})
    • .delete({region, space_guid})

    Valid params: name, developer_guid, app_guid

  • .apps()

    • .getAll({region, space_guid, params})
    • .get({region})
  • .services()

    • .getAll({region, space_guid, params})
  • .containers()

    • .getAll({region, space_guid})
    • .get({region, space_guid, container})
    • .start({container, region, space_guid})
    • .stop({container, region, space_guid})
    • .pause({container, region, space_guid})
    • .unpause({container, region, space_guid})
    • .restart({container, region, space_guid})
    • .delete({container, region, space_guid})
  • .groups()

    • .getAll({region, space_guid})
    • .get({region, space_guid, group})
    • .delete({region, space_guid, group})
    • .update(region, space_guid, group, form : {NumberInstances: {Desired, Min, Max}, Autorecovery})
      • http://ccsapi-doc.mybluemix.net/#!/Container_Groups/patch_containers_groups_name_or_id
  • .volumes()

    • .getAll({region, space_guid})
  • .images()

    • .getAll({region, space_guid})
    • .get({region, space_guid, image})
    • .validate({region, space_guid, image, name}) // image or name. image = id, name = full path name of the image, including registry and namespace.
    • .validateSummary({region, space_guid, image, name}) // it will return last analysis
    • .delete({region, space_guid, image})
  • .logs()

    • .apps({region, space_guid, app})
    • .containers({region, space_guid, container})
  • .events()

    • .apps({region, type})
    • .services({region, type})

    type = create | delete | update

  • .all()

    • .get({region, space_guid}) : all services, apps and containers for a space
    • .get({region}) : all services, apps and containers for all spaces

TODO:

  • implement more services and methods

Tips

  • Image Validation Service

The response from the image validation service is tricky to process in order to get if an image is vulnerable or not. The .images().validateSummary() returns a clear JSON with the vulnerabilities and if the attribute "vulnerable" set to true or false.

	{
		_score: 7.958448,
		_type: "vulnerabilityscan",
		_id: "tm12fk4yQD6g9gyNSlwueA",
		_source: {
			total_usns_for_distro: 499,
			description: "Overall vulnerability status",
			vulnerable_packages: 4,
			timestamp: "2016-01-18T13:35:13+0000",
			@timestamp: "2016-01-18T13:35:18.404Z",
			namespace: "registry.eu-gb.bluemix.net/xxxxxx/myimage:tag",
			vulnerable_usns: 3,
			os_distrbution: "ubuntu",
			os_version: "trusty",
			crawled_time: "2016-01-18T13:35:13+0000",
			total_packages: 232,
			@version: "1",
			vulnerable: true,
			uuid: "3d0f9dc4-bde8-11e5-aee5-0242ac113ff3"
		},
		_index: "vulnerabilityscan-2016.01.18",
		vulnerabilities: [
			{
				url: "http://www.ubuntu.com/usn/usn-2861-1",
				usnid: "usn-2861-1",
				summary: "libpng could be made to crash or run programs as your login if it opened aspecially crafted file."
			},
			{
				url: "http://www.ubuntu.com/usn/usn-2865-1",
				usnid: "usn-2865-1",
				summary: "GnuTLS could be made to expose sensitive information over the network."
			},
			{
				url: "http://www.ubuntu.com/usn/usn-2868-1",
				usnid: "usn-2868-1",
				summary: "DHCP server, client, or relay could be made to crash if they receivedspecially crafted network traffic."
			}
		]
	}