import type { NaturalNumber, NaturalNumberOrZero } from "../../../common/CustomTypes/Numerics";
import type { RootedPath } from "../../../common/CustomTypes/RootedPath";
import type { Dict } from "../../../common/Types";
import type { Arn } from "../../CustomTypes/Arn";
import type { AwsResourceCommon, CloudFormationTags, S3Location } from "../common";
import type { CloudFormationValue } from "../IntrinsicFunctions";
import type { EndpointConfiguration } from "./common";
import type { AwsApiGatewayMethodIntegrationType, HttpMethod } from "./Method";
export declare type RestApiType = 'AWS::ApiGateway::RestApi';
export interface RestApi extends AwsResourceCommon {
    Type: RestApiType;
    Properties: RestApiProperties;
}
export interface RestApiProperties {
    ApiKeySourceType?: string;
    BinaryMediaTypes?: string[];
    Body?: ExtendedOpenAPIDefinition;
    BodyS3Location?: S3Location;
    CloneFrom?: string;
    Description?: string;
    DisableExecuteApiEndpoint?: boolean;
    Mode?: 'merge' | 'overwrite';
    EndpointConfiguration?: EndpointConfiguration;
    FailOnWarnings?: boolean;
    MinimumCompressionSize?: number | null;
    Name?: string;
    Parameters?: Record<string, string>;
    Policy?: object;
    Tags?: CloudFormationTags;
}
export declare type ExtendedOpenAPIDefinition = ExtendedSwagger2Definition;
export interface ExtendedSwagger2Definition {
    [x: string]: unknown;
    swagger: '2.0';
    info: {
        title: CloudFormationValue;
        version: CloudFormationValue;
    };
    paths: Record<RootedPath, PathSwagger2Definition>;
    securityDefinitions?: Record<string, SwaggerSecurityDefinition>;
}
export declare type SwaggerHttpMethod = Lowercase<Exclude<HttpMethod, 'ANY'>> | 'x-amazon-apigateway-any-method';
export declare type PathSwagger2Definition = Dict<EndpointSwagger2Definition, SwaggerHttpMethod>;
export interface EndpointSwagger2Definition {
    [x: string]: unknown;
    parameters?: SwaggerMethodParameter[];
    security?: Record<string, string[]>[];
    'x-amazon-apigateway-integration': AWSIntegrationExtension;
}
export declare type AWSIntegrationExtension = MockAWSIntegrationExtension | ProxyAWSIntegrationExtension;
export interface AWSIntegrationExtensionBase {
    cacheKeyParameters?: string[];
    cacheNamespace?: string;
    connectionId?: CloudFormationValue;
    connectionType?: 'INTERNET' | 'VPC_LINK';
    credentials?: CloudFormationValue<Arn>;
    contentHandling?: ContentHandling;
    httpMethod?: HttpMethod;
    passthroughBehavior?: 'never' | 'when_no_match' | 'when_no_templates';
    requestParameters?: AWSIntegrationRequestParameters;
    requestTemplates?: AWSIntegrationRequestTemplates;
    responses?: AWSIntegrationResponses;
    timeoutInMillis?: NaturalNumber;
    type: Lowercase<AwsApiGatewayMethodIntegrationType>;
    tlsConfig?: AWSIntegrationTLSConfig;
    uri?: CloudFormationValue;
}
export interface MockAWSIntegrationExtension extends AWSIntegrationExtensionBase {
    httpMethod?: never;
    type: 'mock';
}
export interface ProxyAWSIntegrationExtension extends AWSIntegrationExtensionBase {
    httpMethod: HttpMethod;
    type: Lowercase<Exclude<AwsApiGatewayMethodIntegrationType, 'MOCK'>>;
}
export declare type ContentHandling = 'CONVERT_TO_BINARY' | 'CONVERT_TO_TEXT';
export declare type AWSIntegrationRequestParameters = Record<IntegrationParameter, MethodParameter | string>;
export declare type IntegrationParameter = `integration.request.${HttpParameterType}.${string}`;
export declare type MethodParameter = `method.request.${HttpParameterType}.${string}`;
export declare type HttpParameterType = 'body' | 'header' | 'path' | 'querystring';
export declare type AWSIntegrationRequestTemplates = Record<string, CloudFormationValue>;
export declare type AWSIntegrationResponses = Record<number | string, AWSIntegrationResponse>;
export interface AWSIntegrationResponse {
    statusCode: string;
    responseTemplates?: AWSIntegrationResponseTemplates;
    responseParameters?: AWSIntegrationResponseParameters;
    contentHandling?: ContentHandling;
}
export declare type AWSIntegrationResponseTemplates = Record<string, string>;
export declare type AWSIntegrationResponseParameters = Record<AWSIntegrationResponseParameter, AWSIntegrationResponseParameterValue>;
export declare type AWSIntegrationResponseParameter = `method.response.header.${string}`;
export declare type AWSIntegrationResponseParameterValue = `'${string}'` | `integration.response.${'body' | 'header'}.${string}`;
export interface AWSIntegrationTLSConfig {
    insecureSkipVerification?: boolean;
}
export declare type SwaggerMethodParameter = SwaggerMethodNonPathParameter | SwaggerMethodPathParameter;
export interface SwaggerMethodParameterBase {
    name: string;
    in: SwaggerParameterLocation;
    description?: string;
    required?: boolean;
}
export interface SwaggerMethodNonPathParameter extends SwaggerMethodParameterBase {
    in: Exclude<SwaggerParameterLocation, 'path'>;
}
export interface SwaggerMethodPathParameter extends SwaggerMethodParameterBase {
    in: 'path';
    required: true;
}
export declare type SwaggerParameterLocation = 'body' | 'formData' | 'header' | 'path' | 'query';
export declare type SwaggerSecurityDefinition = SwaggerApiKeySecurityDefinition | SwaggerBasicSecurityDefinition | SwaggerOAuthSecurityDefinition;
export interface SwaggerSecurityDefinitionBase {
    type: SwaggerSecurityDefinitionType;
    description?: string;
    name?: string;
    in?: SwaggerSecurityDefinitionApiKeyLocation;
    flow?: SwaggerSecurityDefinitionOAuthFlow;
    authorizationUrl?: string;
    tokenUrl?: string;
    scopes?: ScopesObject;
    [k: `x-${string}`]: unknown;
}
export interface SwaggerBasicSecurityDefinition extends SwaggerSecurityDefinitionBase {
    type: 'basic';
    name?: never;
    in?: never;
    flow?: never;
    authorizationUrl?: never;
    tokenUrl?: never;
    scopes?: never;
}
export interface SwaggerApiKeySecurityDefinition extends SwaggerSecurityDefinitionBase {
    type: 'apiKey';
    name: string;
    in: SwaggerSecurityDefinitionApiKeyLocation;
    flow?: never;
    authorizationUrl?: never;
    tokenUrl?: never;
    scopes?: never;
}
export declare type SwaggerOAuthSecurityDefinition = SwaggerOAuthAccessCodeSecurityDefinition | SwaggerOAuthApplicationSecurityDefinition | SwaggerOAuthImplicitSecurityDefinition | SwaggerOAuthPasswordSecurityDefinition;
export interface SwaggerOAuthSecurityDefinitionBase extends SwaggerSecurityDefinitionBase {
    type: 'oauth2';
    name?: never;
    in?: never;
    flow: SwaggerSecurityDefinitionOAuthFlow;
    authorizationUrl?: string;
    tokenUrl?: string;
    scopes: ScopesObject;
}
export interface SwaggerOAuthAccessCodeSecurityDefinition extends SwaggerOAuthSecurityDefinitionBase {
    flow: 'accessCode';
    authorizationUrl: string;
    tokenUrl: string;
}
export interface SwaggerOAuthApplicationSecurityDefinition extends SwaggerOAuthSecurityDefinitionBase {
    flow: 'application';
    authorizationUrl?: never;
    tokenUrl: string;
}
export interface SwaggerOAuthImplicitSecurityDefinition extends SwaggerOAuthSecurityDefinitionBase {
    flow: 'implicit';
    authorizationUrl: string;
    tokenUrl?: never;
}
export interface SwaggerOAuthPasswordSecurityDefinition extends SwaggerOAuthSecurityDefinitionBase {
    flow: 'password';
    authorizationUrl?: never;
    tokenUrl: string;
}
export declare type SwaggerSecurityDefinitionType = 'apiKey' | 'basic' | 'oauth2';
export declare type SwaggerSecurityDefinitionApiKeyLocation = 'header' | 'header';
export declare type SwaggerSecurityDefinitionOAuthFlow = 'accessCode' | 'application' | 'implicit' | 'password';
export declare type ScopesObject = Record<`x-${string}`, unknown> & Record<string, string>;
export interface SwaggerAWSAuthorizerExtension extends SwaggerApiKeySecurityDefinition {
    in: 'header';
    'x-amazon-apigateway-authtype': AwsApiGatewayAuthType;
    'x-amazon-apigateway-authorizer': AwsApiGatewayAuthorizer;
}
export declare type AwsApiGatewayAuthorizer = AwsApiGatewayCognitoAuthorizer | AwsApiGatewayLambdaAuthorizer;
export interface AwsApiGatewayAuthorizerBase {
    type: AwsApiGatewayAuthorizerType;
    authorizerUri?: CloudFormationValue<Arn>;
    authorizerCredentials?: CloudFormationValue<Arn>;
    identitySource?: CloudFormationValue;
    identityValidationExpression?: string;
    authorizerResultTtlInSeconds?: NaturalNumberOrZero;
    providerARNs?: CloudFormationValue<Arn[]> | CloudFormationValue<Arn>[];
}
export interface AwsApiGatewayLambdaAuthorizer extends AwsApiGatewayAuthorizerBase {
    type: Exclude<AwsApiGatewayAuthorizerType, 'cognito_user_pools'>;
    authorizerUri: CloudFormationValue<Arn>;
    providerARNs?: never;
}
export interface AwsApiGatewayCognitoAuthorizer extends AwsApiGatewayAuthorizerBase {
    type: 'cognito_user_pools';
    authorizerUri?: never;
    authorizerCredentials?: never;
    identitySource?: never;
    identityValidationExpression?: never;
    authorizerResultTtlInSeconds?: never;
    providerARNs: CloudFormationValue<Arn[]> | CloudFormationValue<Arn>[];
}
export declare type AwsApiGatewayAuthType = 'cognito_user_pools' | 'custom' | 'oauth2';
export declare type AwsApiGatewayAuthorizerType = 'cognito_user_pools' | 'request' | 'token';
