UNPKG

@mdf.js/openc2-core

Version:

MMS - API Core - OpenC2

125 lines 5.82 kB
/** * Copyright 2024 Mytra Control S.L. All rights reserved. * * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file * or at https://opensource.org/licenses/MIT. */ import { Control } from '../types'; export declare class Helpers { /** * Return a "Processing" response message for concrete command or undefined if the response * its not needed * @param command - Command to be response * @param id - Consumer identification * @param result - Command result * @param statusText - Status text */ static processing(command: Control.CommandMessage, id: string, result?: Control.Results, statusText?: string): Control.ResponseMessage | undefined; /** * Return a "OK" response message for concrete command or undefined if the response * its not needed * @param command - Command to be response * @param id - Consumer identification * @param result - Command result * @param statusText - Status text */ static ok(command: Control.CommandMessage, id: string, result?: Control.Results, statusText?: string): Control.ResponseMessage | undefined; /** * Return a "Bad Request" response message for concrete command or undefined if the response * its not needed * @param command - Command to be response * @param id - Consumer identification * @param statusText - Status text */ static badRequest(command: Control.CommandMessage, id: string, statusText?: string): Control.ResponseMessage | undefined; /** * Return a "Unauthorized " response message for concrete command or undefined if the response * its not needed * @param command - Command to be response * @param id - Consumer identification * @param statusText - Status text */ static unauthorized(command: Control.CommandMessage, id: string, statusText?: string): Control.ResponseMessage | undefined; /** * Return a "Forbidden" response message for concrete command or undefined if the response * its not needed * @param command - Command to be response * @param id - Consumer identification * @param statusText - Status text */ static forbidden(command: Control.CommandMessage, id: string, statusText?: string): Control.ResponseMessage | undefined; /** * Return a "Not Found" response message for concrete command or undefined if the response * its not needed * @param command - Command to be response * @param id - Consumer identification * @param statusText - Status text */ static notFound(command: Control.CommandMessage, id: string, statusText?: string): Control.ResponseMessage | undefined; /** * Return a "Internal Error" response message for concrete command or undefined if the response * its not needed * @param command - Command to be response * @param id - Consumer identification * @param statusText - Status text */ static internalError(command: Control.CommandMessage, id: string, statusText?: string): Control.ResponseMessage | undefined; /** * Return a "Not implemented" response message for concrete command or undefined if the response * its not needed * @param command - Command to be response * @param id - Consumer identification * @param statusText - Status text */ static notImplemented(command: Control.CommandMessage, id: string, statusText?: string): Control.ResponseMessage | undefined; /** * Return a "Service Unavailable" response message for concrete command or undefined if the * response its not needed * @param command - Command to be response * @param id - Consumer identification * @param statusText - Status text */ static serviceUnavailable(command: Control.CommandMessage, id: string, statusText?: string): Control.ResponseMessage | undefined; /** * Return response with the indicated code message for concrete command or undefined if the * response its not needed * @param command - Command to be response * @param id - Consumer identification * @param code - Status code * @param results - response results to be included * @param statusText - Status text */ protected static baseResponse(command: Control.CommandMessage, id: string, status: number, results?: Control.Results, statusText?: string): Control.ResponseMessage | undefined; /** * Create a command message * @param to - expected receiver of this command * @param content - command content * @param id - producer identification * @returns */ static createCommand(to: string[], content: Control.Command, id: string): Control.CommandMessage; /** * Create a command message * @param to - expected receiver of this command * @param action - command action * @param target - command target * @param id - producer identification * @returns */ static createCommandByAction(to: string[], action: Control.Action, target: Control.Target, id: string): Control.CommandMessage; /** * Return the "query features" request with the requested duration * @returns */ static queryFeatures(duration: number): Control.Command; /** * Return a "Query Features" response based in the request received * @param command - Command to be response * @param id - Consumer identification * @param pairs - Action-Target pairs supported by the consumer * @param profiles - Profiles supported by the consumer * @returns */ static respondFeatures(command: Control.CommandMessage, id: string, pairs: Control.ActionTargetPairs, profiles?: string[]): Control.ResponseMessage; } //# sourceMappingURL=Helpers.d.ts.map