import * as iam from "../../aws-iam";
import { Duration } from "../../core";
import { Method } from './method';
import { IVpcLink } from './vpc-link';
/**
 * @experimental
 */
export interface IntegrationOptions {
    /**
     * (experimental) A list of request parameters whose values are to be cached.
     *
     * It determines
     * request parameters that will make it into the cache key.
     *
     * @experimental
     */
    readonly cacheKeyParameters?: string[];
    /**
     * (experimental) An API-specific tag group of related cached parameters.
     *
     * @experimental
     */
    readonly cacheNamespace?: string;
    /**
     * (experimental) Specifies how to handle request payload content type conversions.
     *
     * @default none if this property isn't defined, the request payload is passed
     * through from the method request to the integration request without
     * modification, provided that the `passthroughBehaviors` property is
     * configured to support payload pass-through.
     * @experimental
     */
    readonly contentHandling?: ContentHandling;
    /**
     * (experimental) An IAM role that API Gateway assumes.
     *
     * Mutually exclusive with `credentialsPassThrough`.
     *
     * @default A role is not assumed
     * @experimental
     */
    readonly credentialsRole?: iam.IRole;
    /**
     * (experimental) Requires that the caller's identity be passed through from the request.
     *
     * @default Caller identity is not passed through
     * @experimental
     */
    readonly credentialsPassthrough?: boolean;
    /**
     * (experimental) Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource.
     *
     * There are three valid values: WHEN_NO_MATCH, WHEN_NO_TEMPLATES, and
     * NEVER.
     *
     * @experimental
     */
    readonly passthroughBehavior?: PassthroughBehavior;
    /**
     * (experimental) The request parameters that API Gateway sends with the backend request.
     *
     * Specify request parameters as key-value pairs (string-to-string
     * mappings), with a destination as the key and a source as the value.
     *
     * Specify the destination by using the following pattern
     * integration.request.location.name, where location is querystring, path,
     * or header, and name is a valid, unique parameter name.
     *
     * The source must be an existing method request parameter or a static
     * value. You must enclose static values in single quotation marks and
     * pre-encode these values based on their destination in the request.
     *
     * @experimental
     */
    readonly requestParameters?: {
        [dest: string]: string;
    };
    /**
     * (experimental) A map of Apache Velocity templates that are applied on the request payload.
     *
     * The template that API Gateway uses is based on the value of the
     * Content-Type header that's sent by the client. The content type value is
     * the key, and the template is the value (specified as a string), such as
     * the following snippet:
     *
     * ```
     *    { "application/json": "{ \"statusCode\": 200 }" }
     * ```
     *
     * @see http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
     * @experimental
     */
    readonly requestTemplates?: {
        [contentType: string]: string;
    };
    /**
     * (experimental) The maximum amount of time an integration will run before it returns without a response.
     *
     * Must be between 50 milliseconds and 29 seconds.
     *
     * @default Duration.seconds(29)
     * @experimental
     */
    readonly timeout?: Duration;
    /**
     * (experimental) The response that API Gateway provides after a method's backend completes processing a request.
     *
     * API Gateway intercepts the response from the
     * backend so that you can control how API Gateway surfaces backend
     * responses. For example, you can map the backend status codes to codes
     * that you define.
     *
     * @experimental
     */
    readonly integrationResponses?: IntegrationResponse[];
    /**
     * (experimental) The type of network connection to the integration endpoint.
     *
     * @default - ConnectionType.VPC_LINK if `vpcLink` property is configured; ConnectionType.Internet otherwise.
     * @experimental
     */
    readonly connectionType?: ConnectionType;
    /**
     * (experimental) The VpcLink used for the integration.
     *
     * Required if connectionType is VPC_LINK
     *
     * @experimental
     */
    readonly vpcLink?: IVpcLink;
}
/**
 * @experimental
 */
export interface IntegrationProps {
    /**
     * (experimental) Specifies an API method integration type.
     *
     * @experimental
     */
    readonly type: IntegrationType;
    /**
     * (experimental) The Uniform Resource Identifier (URI) for the integration.
     *
     * - If you specify HTTP for the `type` property, specify the API endpoint URL.
     * - If you specify MOCK for the `type` property, don't specify this property.
     * - If you specify AWS for the `type` property, specify an AWS service that
     *    follows this form: `arn:partition:apigateway:region:subdomain.service|service:path|action/service_api.`
     *    For example, a Lambda function URI follows this form:
     *    arn:partition:apigateway:region:lambda:path/path. The path is usually in the
     *    form /2015-03-31/functions/LambdaFunctionARN/invocations.
     *
     * @see https://docs.aws.amazon.com/apigateway/api-reference/resource/integration/#uri
     * @experimental
     */
    readonly uri?: any;
    /**
     * (experimental) The integration's HTTP method type.
     *
     * Required unless you use a MOCK integration.
     *
     * @experimental
     */
    readonly integrationHttpMethod?: string;
    /**
     * (experimental) Integration options.
     *
     * @experimental
     */
    readonly options?: IntegrationOptions;
}
/**
 * (experimental) Result of binding an Integration to a Method.
 *
 * @experimental
 */
export interface IntegrationConfig {
    /**
     * (experimental) Integration options.
     *
     * @default - no integration options
     * @experimental
     */
    readonly options?: IntegrationOptions;
    /**
     * (experimental) Specifies an API method integration type.
     *
     * @experimental
     */
    readonly type: IntegrationType;
    /**
     * (experimental) The Uniform Resource Identifier (URI) for the integration.
     *
     * @default - no URI. Usually applies to MOCK integration
     * @see https://docs.aws.amazon.com/apigateway/api-reference/resource/integration/#uri
     * @experimental
     */
    readonly uri?: string;
    /**
     * (experimental) The integration's HTTP method type.
     *
     * @default - no integration method specified.
     * @experimental
     */
    readonly integrationHttpMethod?: string;
    /**
     * (experimental) This value is included in computing the Deployment's fingerprint.
     *
     * When the fingerprint
     * changes, a new deployment is triggered.
     * This property should contain values associated with the Integration that upon changing
     * should trigger a fresh the Deployment needs to be refreshed.
     *
     * @default undefined deployments are not triggered for any change to this integration.
     * @experimental
     */
    readonly deploymentToken?: string;
}
/**
 * (experimental) Base class for backend integrations for an API Gateway method.
 *
 * Use one of the concrete classes such as `MockIntegration`, `AwsIntegration`, `LambdaIntegration`
 * or implement on your own by specifying the set of props.
 *
 * @experimental
 */
export declare class Integration {
    private readonly props;
    /**
     * @experimental
     */
    constructor(props: IntegrationProps);
    /**
     * (experimental) Can be overridden by subclasses to allow the integration to interact with the method being integrated, access the REST API object, method ARNs, etc.
     *
     * @experimental
     */
    bind(_method: Method): IntegrationConfig;
}
/**
 * @experimental
 */
export declare enum ContentHandling {
    /**
     * (experimental) Converts a request payload from a base64-encoded string to a binary blob.
     *
     * @experimental
     */
    CONVERT_TO_BINARY = "CONVERT_TO_BINARY",
    /**
     * (experimental) Converts a request payload from a binary blob to a base64-encoded string.
     *
     * @experimental
     */
    CONVERT_TO_TEXT = "CONVERT_TO_TEXT"
}
/**
 * @experimental
 */
export declare enum IntegrationType {
    /**
     * (experimental) For integrating the API method request with an AWS service action, including the Lambda function-invoking action.
     *
     * With the Lambda
     * function-invoking action, this is referred to as the Lambda custom
     * integration. With any other AWS service action, this is known as AWS
     * integration.
     *
     * @experimental
     */
    AWS = "AWS",
    /**
     * (experimental) For integrating the API method request with the Lambda function-invoking action with the client request passed through as-is.
     *
     * This integration is
     * also referred to as the Lambda proxy integration
     *
     * @experimental
     */
    AWS_PROXY = "AWS_PROXY",
    /**
     * (experimental) For integrating the API method request with an HTTP endpoint, including a private HTTP endpoint within a VPC.
     *
     * This integration is also referred to
     * as the HTTP custom integration.
     *
     * @experimental
     */
    HTTP = "HTTP",
    /**
     * (experimental) For integrating the API method request with an HTTP endpoint, including a private HTTP endpoint within a VPC, with the client request passed through as-is.
     *
     * This is also referred to as the HTTP proxy integration
     *
     * @experimental
     */
    HTTP_PROXY = "HTTP_PROXY",
    /**
     * (experimental) For integrating the API method request with API Gateway as a "loop-back" endpoint without invoking any backend.
     *
     * @experimental
     */
    MOCK = "MOCK"
}
/**
 * @experimental
 */
export declare enum PassthroughBehavior {
    /**
     * (experimental) Passes the request body for unmapped content types through to the integration back end without transformation.
     *
     * @experimental
     */
    WHEN_NO_MATCH = "WHEN_NO_MATCH",
    /**
     * (experimental) Rejects unmapped content types with an HTTP 415 'Unsupported Media Type' response.
     *
     * @experimental
     */
    NEVER = "NEVER",
    /**
     * (experimental) Allows pass-through when the integration has NO content types mapped to templates.
     *
     * However if there is at least one content type defined,
     * unmapped content types will be rejected with the same 415 response.
     *
     * @experimental
     */
    WHEN_NO_TEMPLATES = "WHEN_NO_TEMPLATES"
}
/**
 * @experimental
 */
export declare enum ConnectionType {
    /**
     * (experimental) For connections through the public routable internet.
     *
     * @experimental
     */
    INTERNET = "INTERNET",
    /**
     * (experimental) For private connections between API Gateway and a network load balancer in a VPC.
     *
     * @experimental
     */
    VPC_LINK = "VPC_LINK"
}
/**
 * @experimental
 */
export interface IntegrationResponse {
    /**
     * (experimental) Specifies the regular expression (regex) pattern used to choose an integration response based on the response from the back end.
     *
     * For example, if the success response returns nothing and the error response returns some string, you
     * could use the ``.+`` regex to match error response. However, make sure that the error response does not contain any
     * newline (``\n``) character in such cases. If the back end is an AWS Lambda function, the AWS Lambda function error
     * header is matched. For all other HTTP and AWS back ends, the HTTP status code is matched.
     *
     * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-integration-settings-integration-response.html
     * @experimental
     */
    readonly selectionPattern?: string;
    /**
     * (experimental) The status code that API Gateway uses to map the integration response to a MethodResponse status code.
     *
     * @experimental
     */
    readonly statusCode: string;
    /**
     * (experimental) Specifies how to handle request payload content type conversions.
     *
     * @default none the request payload is passed through from the method
     * request to the integration request without modification.
     * @experimental
     */
    readonly contentHandling?: ContentHandling;
    /**
     * (experimental) The response parameters from the backend response that API Gateway sends to the method response.
     *
     * Use the destination as the key and the source as the value:
     *
     * - The destination must be an existing response parameter in the
     *    MethodResponse property.
     * - The source must be an existing method request parameter or a static
     *    value. You must enclose static values in single quotation marks and
     *    pre-encode these values based on the destination specified in the
     *    request.
     *
     * @see http://docs.aws.amazon.com/apigateway/latest/developerguide/request-response-data-mappings.html
     * @experimental
     */
    readonly responseParameters?: {
        [destination: string]: string;
    };
    /**
     * (experimental) The templates that are used to transform the integration response body.
     *
     * Specify templates as key-value pairs, with a content type as the key and
     * a template as the value.
     *
     * @see http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
     * @experimental
     */
    readonly responseTemplates?: {
        [contentType: string]: string;
    };
}
