diff --git a/examples/example-get-account.js b/examples/example-get-account.js deleted file mode 100755 index 2499e9a..0000000 --- a/examples/example-get-account.js +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env node -/** - * Example creating a Triton API client and using it to get account info. - * - * Usage: - * ./example-get-account.js - * - * # With trace-level logging - * LOG_LEVEL=trace ./example-get-account.js 2>&1 | bunyan - */ - -var bunyan = require('bunyan'); -var path = require('path'); -var triton = require('../'); // typically `require('triton');` - -var log = bunyan.createLogger({ - name: path.basename(__filename), - level: process.env.LOG_LEVEL || 'info', - stream: process.stderr -}); - -triton.createClient({ - log: log, - // Use 'env' to pick up 'TRITON_/SDC_' env vars. Or manually specify a - // `profile` object. - profileName: 'env', - unlockKeyFn: triton.promptPassphraseUnlockKey -}, function createdClient(err, client) { - if (err) { - console.error('error creating Triton client: %s\n%s', err, err.stack); - process.exitStatus = 1; - return; - } - - // TODO: Eventually the top-level TritonApi will have `.getAccount()`. - client.cloudapi.getAccount(function (err, account) { - client.close(); // Remember to close the client to close TCP conn. - if (err) { - console.error('getAccount error: %s\n%s', err, err.stack); - process.exitStatus = 1; - } else { - console.log(JSON.stringify(account, null, 4)); - } - }); -}); diff --git a/examples/example-list-instances.js b/examples/example-list-instances.js deleted file mode 100755 index deb1c61..0000000 --- a/examples/example-list-instances.js +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env node -/** - * Example creating a Triton API client and using it to list instances. - * - * Usage: - * ./example-list-instances.js - * - * # With trace-level logging - * LOG_LEVEL=trace ./example-list-instances.js 2>&1 | bunyan - */ - -var bunyan = require('bunyan'); -var path = require('path'); -var triton = require('../'); // typically `require('triton');` - -var log = bunyan.createLogger({ - name: path.basename(__filename), - level: process.env.LOG_LEVEL || 'info', - stream: process.stderr -}); - -triton.createClient({ - log: log, - // Use 'env' to pick up 'TRITON_/SDC_' env vars. Or manually specify a - // `profile` object. - profileName: 'env', - unlockKeyFn: triton.promptPassphraseUnlockKey -}, function createdClient(err, client) { - if (err) { - console.error('error creating Triton client: %s\n%s', err, err.stack); - process.exitStatus = 1; - return; - } - - // TODO: Eventually the top-level TritonApi will have `.listInstances()`. - client.cloudapi.listMachines(function (err, insts) { - client.close(); // Remember to close the client to close TCP conn. - - if (err) { - console.error('listInstances error: %s\n%s', err, err.stack); - process.exitStatus = 1; - } else { - console.log(JSON.stringify(insts, null, 4)); - } - }); -}); diff --git a/examples/rbac-simple/README.md b/examples/rbac-simple/README.md deleted file mode 100644 index 04ed5d9..0000000 --- a/examples/rbac-simple/README.md +++ /dev/null @@ -1,27 +0,0 @@ -*Caveat*: All `triton rbac ...` support is experimental. - -This directly holds a super simple example Triton RBAC Profile for a mythical -"Simple Corp.", with `triton` CLI examples showing how to use it for RBAC. - -Our Simple corporation will create an "rbactestsimple" Triton account and -use RBAC to manage its users, roles, etc. It has two users: - -- emma: Should have full access, to everything. -- bert: Should only have read access, again to everything. - -We want an RBAC config that allows appropriate access for all the employees -and tooling. Roughly we'll break that into roles as follows: - -- Role `admin`. Complete access to the API. Only used by "emma" when, e.g., - updating RBAC configuration itself. -- Role `ops`. Full access, except to RBAC configuration updates. -- Role `read`. Read-only access to compute resources. - -See "rbac.json" where we encode all this. - -The `triton rbac apply` command can work with a JSON config file (and -optionally separate user public ssh key files) to create and maintain a -Triton RBAC configuration. In our example this will be: - - triton rbac apply # defaults to looking at "./rbac.json" - diff --git a/examples/rbac-simple/rbac.json b/examples/rbac-simple/rbac.json deleted file mode 100644 index 6355234..0000000 --- a/examples/rbac-simple/rbac.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "users": [ - { "login": "emma", "email": "emma@simple.example.com" }, - { "login": "bert", "email": "bert@simple.example.com" } - ], - "roles": [ - { - "name": "admin", - "default_members": [], - "members": ["emma"], - "policies": ["policy-admin"] - }, - { - "name": "ops", - "default_members": ["emma"], - "members": ["emma"], - "policies": ["policy-full"] - }, - { - "name": "read", - "default_members": ["bert", "emma"], - "members": ["bert", "emma"], - "policies": ["policy-readonly"] - } - ], - "policies": [ - { - "name": "policy-admin", - "description": "full access", - "rules": ["CAN *"] - }, - { - "name": "policy-full", - "description": "full access, except rbac", - "rules": ["CAN compute:*"] - }, - { - "name": "policy-readonly", - "description": "read-only access", - "rules": ["CAN compute:Get*"] - } - ] -}