import grpc from "grpc";
import EnvoyRequestParams from "./envoy-request-params";
import EnvoyContext from "./envoy-context";
import { HttpHeader } from "./types";
/**
 * Setting this header on egress requests will cause Envoy to attempt to retry
 * failed requests (number of retries defaults to 1, and can be controlled by
 * x-envoy-max-retries header or the route config retry policy). gRPC retries
 * are currently only supported for gRPC status codes in response headers. gRPC
 * status codes in trailers will not trigger retry logic.
 */
export declare enum GrpcRetryOn {
    /**
     * Envoy will attempt a retry if the gRPC status code in the response headers is
     * “cancelled” (1)
     */
    CANCELLED = "cancelled",
    /**
     * Envoy will attempt a retry if the gRPC status code in the response headers is
     * “deadline-exceeded” (4)
     */
    DEADLINE_EXCEEDED = "deadline-exceeded",
    /**
     * Envoy will attempt a retry if the gRPC status code in the response headers is
     * “resource-exhausted” (8)
     */
    RESOURCE_EXHAUSTED = "resource-exhausted"
}
/**
 * request params: timeout, retry, etc.
 */
export interface EnvoyGrpcRequestInit {
    maxRetries?: number;
    retryOn?: GrpcRetryOn[];
    timeout?: number;
    perTryTimeout?: number;
    headers?: HttpHeader;
}
/**
 * convert http header to grpc.Metadata
 * @param httpHeader the http header
 * @internal
 */
export declare function httpHeader2Metadata(httpHeader: HttpHeader): grpc.Metadata;
/**
 * the gRPC request params, mainly two parts:
 * 1. EnvoyContext, telling what the situation is
 * 2. request params, like timeout, retry, etc.
 */
export default class EnvoyGrpcRequestParams extends EnvoyRequestParams {
    /**
     * on what condition shall envoy retry
     */
    readonly retryOn: GrpcRetryOn[];
    /**
     * Setting the retry policies, if empty param is given will not generate any headers but using
     * the default setting in Envoy's config
     * @param params the params for initialize the request params
     */
    constructor(context: EnvoyContext, params?: EnvoyGrpcRequestInit);
    /**
     * assemble the request headers for setting retry.
     */
    assembleRequestMeta(): grpc.Metadata;
}
