resourcename
Ketch Resource Name library in TypeScript.
Example Resource Names:
srn:$service:$region:$tenant:$account:$organization:$resource/$info1/$info2
srn:$service:$region:$tenant:$account:$organization:$resource/$info
srn:$service:$region:$tenant:$account:$organization:$resource
srn:$service:$region:$tenant::$organization:$resource
srn:$service:*:$tenant::$organization:*
Installation
npm install -D @ketch-com/resourcename-js
Usage
Format
To format a ResourceName, create the ResourceName object and call string()
:
import {ResourceName} from '@ketch-com/resourcename-js';
console.log(ResourceName({
service: 'service',
region: 'region',
tenant: 'tenant',
account: 'account',
organization: 'organization',
resource: 'resource',
info: ['info1', 'info2'],
}).string());
Parse
To parse the ResourceName from a string, use parse
:
import {parse} from '@ketch-com/resourcename-js';
const rn = parse('srn:service:region:tenant:account:organization:resource/info1/info2');