namespace _heimdall.check_kinds.file_state { /** */ function parameters_schema( ) : _heimdall.helpers.json_schema.type_schema { return { "type": "object", "additionalProperties": false, "properties": { "path": { "type": "string" }, "exist_mode": { "description": "whether the file is supposed to exist or not", "type": "boolean", "default": true, }, "exist_critical": { "description": "whether a violation of the extist state (parameter 'exist_mode') shall be considered as critical (true) or concerning (false)", "type": "boolean", "default": true, }, "age_threshold_concerning": { "description": "in seconds; ignored if 'exist_mode' is set to false", "type": ["null", "integer"], "exclusiveMinimum": 0, "default": null, }, "age_threshold_critical": { "description": "in seconds; ignored if 'exist_mode' is set to false", "type": ["null", "integer"], "exclusiveMinimum": 0, "default": null, }, "size_threshold_concerning": { "description": "in bytes; ignored if 'exist_mode' is set to false", "type": ["null", "integer"], "exclusiveMinimum": 0, "default": null, }, "size_threshold_critical": { "description": "in bytes; ignored if 'exist_mode' is set to false", "type": ["null", "integer"], "exclusiveMinimum": 0, "default": null, }, // deprecated "strict": { "deprecated": true, "description": "", "type": "boolean", "default": true, }, "exist": { "deprecated": true, "description": "", "type": "boolean", "default": true, }, "age_threshold": { "deprecated": true, "description": "", "type": ["null", "integer"], "exclusiveMinimum": 0, "default": null, }, "size_threshold": { "deprecated": true, "description": "", "type": ["null", "integer"], "exclusiveMinimum": 0, "default": null, }, }, "required": [ "path", ] }; } /** */ function normalize_order_node( node : any ) : any { const version : string = ( (! ("exist_mode" in node) ? "v1" : "v2" ); switch (version) { default: { throw (new Error("unhandled version")); break; } case "v1": { if (! ("path" in node)) { throw new Error("missing mandatory field 'path'"); } else { const node_ = Object.assign( { "strict": true, "exist": true, "age_threshold": null, "size_threshold": null, }, node ); return { "exist_mode": node_["exist"], "exist_critical": node_["strict"], "age_threshold_concerning": ( node_["strict"] ? null : node_["age_threshold"] ), "age_threshold_critical": ( node_["strict"] ? node_["age_threshold"] : null ), "size_threshold_concerning": ( node_["strict"] ? null : node_["age_threshold"] ), "size_threshold_critical": ( node_["strict"] ? node_["age_threshold"] : null ), }; } break; } case "v2": { if (! ("path" in node)) { throw new Error("missing mandatory field 'path'"); } else { const node_ = Object.assign( { "exist_mode": true, "exist_critical": true, "age_threshold_concerning": null, "age_threshold_critical": null, "size_threshold_concerning": null, "size_threshold_critical": null, }, node ); return node_; } break; } } } /** */ async function run( parameters ) : Promise<_heimdall.type_result> { return Promise.reject<_heimdall.type_result>(new Error("not implemented")); } /** */ export function check_kind_implementation( ) : type_check_kind { return { "parameters_schema": parameters_schema, "normalize_order_node": normalize_order_node, "run": run, }; } }