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

apimstacker-client

v1.0.0

Published

Client driver of Stacker APIM instance

Downloads

6

Readme

apimstacker-client

Client API and CLI to access APIM instance of Stacker service

About Stacker

Stacker is a simple, trust-based resource sharing broker service. APIM Stacker is an instance of Stacker that manages a pool of APIM server stacks.

apimstacker-client is a Nodejs client driver for APIM instance of Stacker service. Clients can use the CLI to acquire/release an apim stack manually or use API for programmatic access.

CLI: apimstack acquire <jobId>

jobId {String} -- Any string can be used. naming convention: use 'test-*' for short unit test jobs, or use your email address.

CLI: apimstack release <jobId>

jobId {String} -- jobId used in the acquire command.

CLI: apimstack list

shows the current state of the APIMStacker service.

API: acquireApimStack

acquireApimStack is the only API currently supported. Design goal of Stacker is to add minimum functionality and let the users cooperate. For example, multiple users can acquire the same APIM server using the same jobId to share it. Even after it's released, the Stacker does not prevent the releaser from access to the released APIM server. When it's acquired by other user, multiple parties will share the resource.

  • jobId a string to uniquely identify client
  • callback {Function} called with the acquired server url. If the stacker pool is full, it will be delayed indefinitely until an APIM server url is released or expired. - server {String} APIM server url, e.g., 'sjsldev679.dev.ciondemand.com' - releaseApimStack {Function} the user must call this function to release it to the pool.

Example

var JOB_ID = 'test-apis-' + (process.env.TRAVIS_JOB_ID ||
  require('os').hostname() + '-' + Date.now());

require('apimstacker-client').acquireApimStack(JOB_ID,
  function(server, releaseApimStack) {
  // server {String} url of the acquired APIM server, e.g., 'sjsldev789.dev.ciondemand.com'
  // releaseApimStack {Function} 

  // begin: example code to access the acquired APIM server
  process.env.APIM_MANAGEMENT = server;

  ...

  //end: example code to access the acquired APIM server

  delete process.env.APIM_MANAGEMENT;
  releaseApimStack();
  });

apimstacker_diagram

APIMStacker REST API

Ask your Stacker administrator and get the REST endpoint, e.g., apimstacker.stage1.myblumix.net.

Url

Shows the APIMStacker REST API help.

http://apimstacker.stage1.mybluemix.net/

Response

____ APIM Stacker ____
-- show apim stack status:
https://apimstacker.stage1.mybluemix.net/dump-pool
-- acquire stack url:
https://apimstacker.stage1.mybluemix.net/acquire-stack/:jobid
-- release stack url:
https://apimstacker.stage1.mybluemix.net/release-stack/:jobid

Url

Shows the current status of the APIMStacker pool.

https://apimstacker.stage1.mybluemix.net/dump-pool

Response

{
"version":"1.0.0",
"description":"APIM Stacker",
"servers":{
  "sjsldev679.dev.ciondemand.com":{"id":"","acquiredAt":0,"reachable":true,"checkedAt":0},
  "sjsldev967.dev.ciondemand.com":{"id":"","acquiredAt":0,"reachable":true,"checkedAt":0},
  "sjsldev803.dev.ciondemand.com":{"id":"","acquiredAt":0,"reachable":true,"checkedAt":0},
  "sjsldev769.dev.ciondemand.com":{"id":"","acquiredAt":0,"reachable":true,"checkedAt":0},
  "sjsldev911.dev.ciondemand.com":{"id":"","acquiredAt":0,"reachable":true,"checkedAt":0}
  },
"queue":[]
}

Url

Acquires an APIM server. The jobId can be any string that uniquely identifies the client as the acquirer. The acquired APIM server url will be released when it expires. To extend, simply call acquire-stack with the same jobId.

Unit test jobs expire much sooner (like 10 min. vs. 3 hrs) than other jobs. If the jobId starts with 'test-', it's deemed as a test job.

https://apimstacker.stage1.mybluemix.net/acquire-stack/[email protected]

Response

{"jobId":"[email protected]","server":"sjsldev789.dev.ciondemand.com"}

Url

Releases the acquired APIM server. The jobId is the string used when the server was acquired. The acquired APIM server url will be automatically released to the pool when it expires. Your Stacker service administrator sets the grace period, for example, three hours.

https://apimstacker.stage1.mybluemix.net/release-stack/[email protected]

Response

{"jobId":"[email protected]","server":""}