@bussolabs/closeyourit-cli 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/commands/agents/tokens/create.d.ts +9 -0
- package/dist/commands/agents/tokens/create.js +25 -0
- package/dist/commands/agents/tokens/list.d.ts +9 -0
- package/dist/commands/agents/tokens/list.js +25 -0
- package/dist/commands/agents/tokens/revoke.d.ts +12 -0
- package/dist/commands/agents/tokens/revoke.js +25 -0
- package/oclif.manifest.json +2794 -2669
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,6 +117,9 @@ organization are stored locally.
|
|
|
117
117
|
| `agents delete <id> --confirm` | Delete an agent and its run history. |
|
|
118
118
|
| `agents runs list <agent-id> [--page]` | List an agent's run history. |
|
|
119
119
|
| `agents runs show <agent-id> <run-id>` | Show a single run (with output). |
|
|
120
|
+
| `agents tokens list [--page]` | List the org automator tokens (cyi_a_). |
|
|
121
|
+
| `agents tokens create <name>` | Create an org automator token (secret shown only once). |
|
|
122
|
+
| `agents tokens revoke <id> --confirm` | Revoke an org automator token. |
|
|
120
123
|
| `monitors create --project <id\|key> --url <url> [--environment] [--http-method] [--interval-seconds] [--expected-status] [--timeout-seconds] [--expected-body-keyword] [--ssl-expiry-warn-days] [--group-id]` | Create an uptime monitor (one per environment). |
|
|
121
124
|
| `monitors update <id> --project <id\|key> [--url] [--http-method] [--interval-seconds] [--expected-status] [--timeout-seconds] [--expected-body-keyword] [--ssl-expiry-warn-days] [--group-id]` | Update an uptime monitor. |
|
|
122
125
|
| `monitors publish\|unpublish <id> --project <id\|key>` | Publish / unpublish the monitor's public status page. |
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base';
|
|
2
|
+
export default class AgentsTokensCreate extends BaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
name: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
run(): Promise<unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../../base");
|
|
5
|
+
class AgentsTokensCreate extends base_1.BaseCommand {
|
|
6
|
+
static args = {
|
|
7
|
+
name: core_1.Args.string({ description: 'Token name (e.g. automator)', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static description = 'Create an org automator token (cyi_a_ — the secret is shown only once)';
|
|
10
|
+
static examples = ['<%= config.bin %> agents tokens create automator'];
|
|
11
|
+
async run() {
|
|
12
|
+
const { args } = await this.parse(AgentsTokensCreate);
|
|
13
|
+
const res = await this.api.post('/cli/v1/agents/tokens', { name: args.name });
|
|
14
|
+
const token = res.data ?? {};
|
|
15
|
+
if (!this.jsonEnabled()) {
|
|
16
|
+
this.log('Automator token created. Store the secret now — it is shown only once:');
|
|
17
|
+
this.log('');
|
|
18
|
+
this.log(` secret: ${token.secret ?? '-'}`);
|
|
19
|
+
this.log('');
|
|
20
|
+
this.warn('The secret cannot be retrieved again. If you lose it, revoke and create a new one.');
|
|
21
|
+
}
|
|
22
|
+
return res;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = AgentsTokensCreate;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base';
|
|
2
|
+
export default class AgentsTokensList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
page: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const base_1 = require("../../../base");
|
|
4
|
+
const output_1 = require("../../../lib/output");
|
|
5
|
+
class AgentsTokensList extends base_1.BaseCommand {
|
|
6
|
+
static description = 'List the org automator tokens (closeyourit-automator authenticates with these)';
|
|
7
|
+
static examples = ['<%= config.bin %> agents tokens list'];
|
|
8
|
+
static flags = { ...base_1.pageFlag };
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags } = await this.parse(AgentsTokensList);
|
|
11
|
+
const res = await this.api.get(`/cli/v1/agents/tokens?page=${flags.page}`);
|
|
12
|
+
const tokens = res.data ?? [];
|
|
13
|
+
if (!this.jsonEnabled()) {
|
|
14
|
+
this.log((0, output_1.renderTable)(['NAME', 'PREFIX', 'LAST USED', 'REVOKED', 'ID'], tokens.map((token) => [
|
|
15
|
+
String(token.name ?? ''),
|
|
16
|
+
String(token.token_prefix ?? ''),
|
|
17
|
+
String(token.last_used_at ?? '-'),
|
|
18
|
+
String(token.revoked_at ?? '-'),
|
|
19
|
+
String(token.id ?? ''),
|
|
20
|
+
])));
|
|
21
|
+
}
|
|
22
|
+
return res;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = AgentsTokensList;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base';
|
|
2
|
+
export default class AgentsTokensRevoke extends BaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
confirm: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<unknown>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../../base");
|
|
5
|
+
class AgentsTokensRevoke extends base_1.BaseCommand {
|
|
6
|
+
static args = {
|
|
7
|
+
id: core_1.Args.string({ description: 'Automator token id', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static description = 'Revoke an org automator token (the automator using it stops syncing)';
|
|
10
|
+
static examples = ['<%= config.bin %> agents tokens revoke <token-id> --confirm'];
|
|
11
|
+
static flags = {
|
|
12
|
+
confirm: core_1.Flags.boolean({ description: 'Required: confirm the revocation' }),
|
|
13
|
+
};
|
|
14
|
+
async run() {
|
|
15
|
+
const { args, flags } = await this.parse(AgentsTokensRevoke);
|
|
16
|
+
if (!flags.confirm) {
|
|
17
|
+
this.error('Refusing to revoke without --confirm.', { exit: 2 });
|
|
18
|
+
}
|
|
19
|
+
await this.api.delete(`/cli/v1/agents/tokens/${encodeURIComponent(args.id)}`);
|
|
20
|
+
if (!this.jsonEnabled())
|
|
21
|
+
this.log(`Revoked automator token ${args.id}`);
|
|
22
|
+
return { revoked: args.id };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = AgentsTokensRevoke;
|