Definitions#

All code blocks below are TypeScript declarations copied from the server. They document validation, not JSON to send or code to paste into a chat. Clients can use any HTTP library without importing these declarations. check.object rejects unknown fields. Custom functions and refinements specify additional checks.

Imported definitions#

scope#

scope = check.object({ fleetId: check.nullable(check.identifier), instanceKey: check.nullable(check.name) })

Related definitions:

diagnosticReport#

diagnosticReport = check.object({ checkedAt: check.integer(), scope,
    checks: check.list(check.object({ id: check.text(100), scope, status: check.choice('pass', 'fail', 'unknown', 'not-applicable'),
        observedAt: check.nullable(check.integer()), message: check.text(1024), remediation: check.nullable(check.text(1024)) }), 1000) })

Related definitions:

diagnosticQuery#

export function diagnosticQuery(input: unknown) {
    if (!(input instanceof URLSearchParams) || [...input.keys()].some(key => !['fleetId', 'instanceKey'].includes(key))
        || input.getAll('fleetId').length > 1 || input.getAll('instanceKey').length > 1)
        return failure('invalid', 'Use one exact diagnostic scope');
    const parsed = scope({ fleetId: input.get('fleetId'), instanceKey: input.get('instanceKey') });
    return parsed.ok && parsed.value.instanceKey !== null && parsed.value.fleetId === null ? failure('invalid', 'An instance requires a fleet') : parsed;
}

Related definitions: