@servisbot/npm-sb-srn

1.0.1 • Public • Published

npm-sb-srn

SRN generation SDK

Overview

npm module to make SRNs "painless"

install

npm install --save @servisbot/npm-sb-srn

Usage

const SRN = require('@servisbot/npm-sb-srn');

const srn = new SRN(args);  // see Environment variables section
assert(srn.isValid());

const srn = SRN.fromString('srn:vault:global:myorg:secretdoc:my-secret-doc-name:78');
assert.equal(srn.getService(), 'vault');
assert.equal(srn.getRegion(), 'global');
assert.equal(srn.getOrganization(), 'myorg');
assert.equal(srn.getResourcetype(), 'secretdoc');
assert.equal(srn.getResource(), 'my-secret-doc-name');
assert.equal(srn.getQualifier(), '78');
assert.equal(srn.generateSRN(), 'srn:vault:global:myorg:secretdoc:my-secret-doc-name:78');

Environment variables

The following environemnt variables will be used if present

SB_SERVICE;
SB_REGION;
SB_RESOURCE_TYPE;
SB_ORGANIZATION;
SB_RESOURCE;
SB_QUALIFIER;

The SRN class will read from the args passed into the constructure and take precidence over env vars if they exist

{
    service,
    region,
    resourcetype,
    organization,
    resource,
    qualifier
}

Readme

Keywords

none

Package Sidebar

Install

npm i @servisbot/npm-sb-srn

Weekly Downloads

197

Version

1.0.1

License

UNLICENSED

Unpacked Size

41.6 kB

Total Files

17

Last publish

Collaborators

  • servisbotnpm