import Toxiproxy from "./Toxiproxy"; import Toxic, { ToxicJson } from "./Toxic"; import { ICreateProxyResponse, IGetProxyResponse, IUpdateProxyBody, ICreateToxicBody } from "./interfaces"; import { HttpClient } from "./HttpClient"; export interface ProxyJson { name: string; listen: string; upstream: string; enabled: boolean; toxics: ToxicJson[]; } export default class Proxy { readonly toxiproxy: Toxiproxy; readonly api: HttpClient; readonly name: string; readonly listen: string; readonly upstream: string; readonly enabled: boolean; constructor(toxiproxy: Toxiproxy, body: ICreateProxyResponse | IGetProxyResponse); getToxiproxy(): Toxiproxy; toJson(): ProxyJson; getHost(): string; getPath(): string; /** * Deletes the proxy from the server. */ remove(): Promise; /** * Updates the existing proxy on the server (e.g. disable an enabled proxy). * * @returns updated proxy */ update(body: IUpdateProxyBody): Promise; /** * Adds a new toxic to the proxy. * * @param body toxic attributes * @returns toxic */ addToxic(body: ICreateToxicBody): Promise>; /** * Gets the toxic from the proxy. * * @param name toxic name * @returns toxic */ getToxic(name: string): Promise>; }