@bussolabs/closeyourit-cli 0.0.7 → 0.0.8
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/dist/commands/monitors/create.d.ts +2 -0
- package/dist/commands/monitors/create.js +6 -0
- package/dist/commands/monitors/update.d.ts +2 -0
- package/dist/commands/monitors/update.js +6 -0
- package/dist/commands/projects/set-platforms.d.ts +11 -0
- package/dist/commands/projects/set-platforms.js +42 -0
- package/oclif.manifest.json +496 -410
- package/package.json +1 -1
|
@@ -9,6 +9,8 @@ export default class MonitorsCreate extends BaseCommand {
|
|
|
9
9
|
'interval-seconds': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
10
|
'expected-status': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
11
|
'timeout-seconds': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
'expected-body-keyword': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
'ssl-expiry-warn-days': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
14
|
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
15
|
};
|
|
14
16
|
run(): Promise<unknown>;
|
|
@@ -17,6 +17,8 @@ class MonitorsCreate extends base_1.BaseCommand {
|
|
|
17
17
|
'interval-seconds': core_1.Flags.integer({ description: 'Seconds between checks' }),
|
|
18
18
|
'expected-status': core_1.Flags.integer({ description: 'Expected HTTP status code' }),
|
|
19
19
|
'timeout-seconds': core_1.Flags.integer({ description: 'Request timeout in seconds' }),
|
|
20
|
+
'expected-body-keyword': core_1.Flags.string({ description: 'Keyword expected in the response body (check fails without it; not with HEAD)' }),
|
|
21
|
+
'ssl-expiry-warn-days': core_1.Flags.integer({ description: 'Alert when the TLS certificate has at most N days left (empty = off)' }),
|
|
20
22
|
};
|
|
21
23
|
async run() {
|
|
22
24
|
const { flags } = await this.parse(MonitorsCreate);
|
|
@@ -32,6 +34,10 @@ class MonitorsCreate extends base_1.BaseCommand {
|
|
|
32
34
|
body.expected_status = flags['expected-status'];
|
|
33
35
|
if (flags['timeout-seconds'] !== undefined)
|
|
34
36
|
body.timeout_seconds = flags['timeout-seconds'];
|
|
37
|
+
if (flags['expected-body-keyword'] !== undefined)
|
|
38
|
+
body.expected_body_keyword = flags['expected-body-keyword'];
|
|
39
|
+
if (flags['ssl-expiry-warn-days'] !== undefined)
|
|
40
|
+
body.ssl_expiry_warn_days = flags['ssl-expiry-warn-days'];
|
|
35
41
|
const res = await this.api.post(`/cli/v1/projects/${encodeURIComponent(projectId)}/monitors`, body);
|
|
36
42
|
if (!this.jsonEnabled()) {
|
|
37
43
|
this.log('Monitor created:');
|
|
@@ -11,6 +11,8 @@ export default class MonitorsUpdate extends BaseCommand {
|
|
|
11
11
|
'interval-seconds': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
12
|
'expected-status': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
13
|
'timeout-seconds': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
'expected-body-keyword': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
'ssl-expiry-warn-days': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
16
|
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
17
|
};
|
|
16
18
|
run(): Promise<unknown>;
|
|
@@ -19,6 +19,8 @@ class MonitorsUpdate extends base_1.BaseCommand {
|
|
|
19
19
|
'interval-seconds': core_1.Flags.integer({ description: 'Seconds between checks' }),
|
|
20
20
|
'expected-status': core_1.Flags.integer({ description: 'Expected HTTP status code' }),
|
|
21
21
|
'timeout-seconds': core_1.Flags.integer({ description: 'Request timeout in seconds' }),
|
|
22
|
+
'expected-body-keyword': core_1.Flags.string({ description: 'Keyword expected in the response body (check fails without it; not with HEAD)' }),
|
|
23
|
+
'ssl-expiry-warn-days': core_1.Flags.integer({ description: 'Alert when the TLS certificate has at most N days left (empty = off)' }),
|
|
22
24
|
};
|
|
23
25
|
async run() {
|
|
24
26
|
const { args, flags } = await this.parse(MonitorsUpdate);
|
|
@@ -34,6 +36,10 @@ class MonitorsUpdate extends base_1.BaseCommand {
|
|
|
34
36
|
body.expected_status = flags['expected-status'];
|
|
35
37
|
if (flags['timeout-seconds'] !== undefined)
|
|
36
38
|
body.timeout_seconds = flags['timeout-seconds'];
|
|
39
|
+
if (flags['expected-body-keyword'] !== undefined)
|
|
40
|
+
body.expected_body_keyword = flags['expected-body-keyword'];
|
|
41
|
+
if (flags['ssl-expiry-warn-days'] !== undefined)
|
|
42
|
+
body.ssl_expiry_warn_days = flags['ssl-expiry-warn-days'];
|
|
37
43
|
const res = await this.api.put(`/cli/v1/projects/${encodeURIComponent(projectId)}/monitors/${encodeURIComponent(args.id)}`, body);
|
|
38
44
|
if (!this.jsonEnabled()) {
|
|
39
45
|
this.log('Monitor updated:');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class ProjectsSetPlatforms extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
code: import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
'platform-id': import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<unknown>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 ProjectsSetPlatforms extends base_1.BaseCommand {
|
|
6
|
+
static description = 'Declare the platforms of a project (replaces the current set)';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> projects set-platforms --project legalbloom-rails --code web',
|
|
9
|
+
'<%= config.bin %> projects set-platforms -p LBRA --code web --code ios',
|
|
10
|
+
];
|
|
11
|
+
static flags = {
|
|
12
|
+
...base_1.projectFlag,
|
|
13
|
+
code: core_1.Flags.string({
|
|
14
|
+
description: 'Platform code, e.g. web (repeatable)',
|
|
15
|
+
multiple: true,
|
|
16
|
+
default: [],
|
|
17
|
+
}),
|
|
18
|
+
'platform-id': core_1.Flags.string({
|
|
19
|
+
description: 'Platform id / UUID (repeatable)',
|
|
20
|
+
multiple: true,
|
|
21
|
+
default: [],
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
async run() {
|
|
25
|
+
const { flags } = await this.parse(ProjectsSetPlatforms);
|
|
26
|
+
const projectId = await this.resolveProjectId(flags.project);
|
|
27
|
+
const res = await this.api.put(`/cli/v1/projects/${projectId}/platforms`, { codes: flags.code, platform_ids: flags['platform-id'] });
|
|
28
|
+
const platforms = res.data ?? [];
|
|
29
|
+
if (!this.jsonEnabled()) {
|
|
30
|
+
if (platforms.length === 0) {
|
|
31
|
+
this.log('Project now declares no platforms.');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.log('Declared platforms:');
|
|
35
|
+
for (const p of platforms)
|
|
36
|
+
this.log(` ${p.code}${p.label ? ` — ${p.label}` : ''}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return res;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = ProjectsSetPlatforms;
|