import { Type as ToxicType, Direction as ToxicDirection } from "./Toxic"; export interface IProxyBody { /** * proxy name */ name: string; /** * listen address (localhost or IP address:port) * * Example: "localhost:12345" will open a proxy on localhost, port 12345 */ listen: string; /** * proxy upstream address (dns name or IP:port) * * Example: "mongodb:27017" will proxy to a mongodb instance running on mongodb host at port 27017 */ upstream: string; /** * true/false (defaults to true on creation) */ enabled?: boolean; } export interface IProxyResponse { /** * proxy name */ name: string; /** * listen address (localhost or IP address:port) * * Example: "localhost:12345" will open a proxy on localhost, port 12345 */ listen: string; /** * proxy upstream address (dns name or IP:port) * * Example: "mongodb:27017" will proxy to a mongodb instance running on mongodb host at port 27017 */ upstream: string; /** * true/false (defaults to true on creation) */ enabled: boolean; /** * list of toxics */ toxics: IToxicResponse[]; } export interface IToxicBody { /** * Toxic name */ name: string; /** * The stream direction must be either upstream or downstream. * upstream applies the toxic on the client -> server connection, * while downstream applies the toxic on the server -> client connection. * This can be used to modify requests and responses separately. * * defaults to downstream */ stream: ToxicDirection; /** * Toxic type */ type: ToxicType; /** * Percentage of connections the toxic will affect. * * defaults to 1.0 (100%) */ toxicity: number; /** * Toxic attributes */ attributes: T; } export type IToxicResponse = IToxicBody; export interface IGetProxiesResponse { [name: string]: IGetProxyResponse; } export type ICreateProxyBody = IProxyBody; export type ICreateProxyResponse = IProxyResponse; export type IPopulateProxiesBody = IProxyBody[]; export interface IPopulateProxiesResponse { proxies: IProxyResponse[]; } export type IGetProxyResponse = IProxyResponse; export interface IUpdateProxyBody { /** * true/false */ enabled: boolean; /** * listen address (localhost or IP address:port) * * Example: "localhost:12345" will open a proxy on localhost, port 12345 */ listen: string; /** * proxy upstream address (dns name or IP:port) * * Example: "mongodb:27017" will proxy to a mongodb instance running on mongodb host at port 27017 */ upstream: string; } export type IUpdateProxyResponse = IProxyResponse; export type IGetToxicsResponse = IToxicResponse[]; export type ICreateToxicBody = IToxicBody; export type ICreateToxicResponse = IToxicResponse; export type IGetToxicResponse = IToxicResponse; export type IUpdateToxicBody = IToxicBody; export type IUpdateToxicResponse = IToxicResponse;