import { Resource } from "../../core";
import { Construct } from 'constructs';
import { IAuthorizer } from './authorizer';
import { Integration } from './integration';
import { MethodResponse } from './methodresponse';
import { IModel } from './model';
import { IRequestValidator, RequestValidatorOptions } from './requestvalidator';
import { IResource } from './resource';
import { IRestApi, RestApi } from './restapi';
/**
 * @experimental
 */
export interface MethodOptions {
    /**
     * (experimental) A friendly operation name for the method.
     *
     * For example, you can assign the
     * OperationName of ListPets for the GET /pets method.
     *
     * @experimental
     */
    readonly operationName?: string;
    /**
     * (experimental) Method authorization. If the value is set of `Custom`, an `authorizer` must also be specified.
     *
     * If you're using one of the authorizers that are available via the {@link Authorizer} class, such as {@link Authorizer#token()},
     * it is recommended that this option not be specified. The authorizer will take care of setting the correct authorization type.
     * However, specifying an authorization type using this property that conflicts with what is expected by the {@link Authorizer}
     * will result in an error.
     *
     * @default - open access unless `authorizer` is specified
     * @experimental
     */
    readonly authorizationType?: AuthorizationType;
    /**
     * (experimental) If `authorizationType` is `Custom`, this specifies the ID of the method authorizer resource.
     *
     * If specified, the value of `authorizationType` must be set to `Custom`
     *
     * @experimental
     */
    readonly authorizer?: IAuthorizer;
    /**
     * (experimental) Indicates whether the method requires clients to submit a valid API key.
     *
     * @default false
     * @experimental
     */
    readonly apiKeyRequired?: boolean;
    /**
     * (experimental) The responses that can be sent to the client who calls the method.
     *
     * @default None
     *
     * This property is not required, but if these are not supplied for a Lambda
     * proxy integration, the Lambda function must return a value of the correct format,
     * for the integration response to be correctly mapped to a response to the client.
     * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-settings-method-response.html
     * @experimental
     */
    readonly methodResponses?: MethodResponse[];
    /**
     * (experimental) The request parameters that API Gateway accepts.
     *
     * Specify request parameters
     * as key-value pairs (string-to-Boolean mapping), with a source as the key and
     * a Boolean as the value. The Boolean specifies whether a parameter is required.
     * A source must match the format method.request.location.name, where the location
     * is querystring, path, or header, and name is a valid, unique parameter name.
     *
     * @default None
     * @experimental
     */
    readonly requestParameters?: {
        [param: string]: boolean;
    };
    /**
     * (experimental) The models which describe data structure of request payload.
     *
     * When
     * combined with `requestValidator` or `requestValidatorOptions`, the service
     * will validate the API request payload before it reaches the API's Integration (including proxies).
     * Specify `requestModels` as key-value pairs, with a content type
     * (e.g. `'application/json'`) as the key and an API Gateway Model as the value.
     *
     * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-settings-method-request.html#setup-method-request-model
     * @experimental
     * @example
     *
     *     declare const api: apigateway.RestApi;
     *     declare const userLambda: lambda.Function;
     *
     *     const userModel: apigateway.Model = api.addModel('UserModel', {
     *         schema: {
     *             type: apigateway.JsonSchemaType.OBJECT,
     *             properties: {
     *                 userId: {
     *                     type: apigateway.JsonSchemaType.STRING
     *                 },
     *                 name: {
     *                     type: apigateway.JsonSchemaType.STRING
     *                 }
     *             },
     *             required: ['userId']
     *         }
     *     });
     *     api.root.addResource('user').addMethod('POST',
     *         new apigateway.LambdaIntegration(userLambda), {
     *             requestModels: {
     *                 'application/json': userModel
     *             }
     *         }
     *     );
     */
    readonly requestModels?: {
        [param: string]: IModel;
    };
    /**
     * (experimental) The ID of the associated request validator.
     *
     * Only one of `requestValidator` or `requestValidatorOptions` must be specified.
     * Works together with `requestModels` or `requestParameters` to validate
     * the request before it reaches integration like Lambda Proxy Integration.
     *
     * @default - No default validator
     * @experimental
     */
    readonly requestValidator?: IRequestValidator;
    /**
     * (experimental) A list of authorization scopes configured on the method.
     *
     * The scopes are used with
     * a COGNITO_USER_POOLS authorizer to authorize the method invocation.
     *
     * @default - no authorization scopes
     * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-authorizationscopes
     * @experimental
     */
    readonly authorizationScopes?: string[];
    /**
     * (experimental) Request validator options to create new validator Only one of `requestValidator` or `requestValidatorOptions` must be specified.
     *
     * Works together with `requestModels` or `requestParameters` to validate
     * the request before it reaches integration like Lambda Proxy Integration.
     *
     * @default - No default validator
     * @experimental
     */
    readonly requestValidatorOptions?: RequestValidatorOptions;
}
/**
 * @experimental
 */
export interface MethodProps {
    /**
     * (experimental) The resource this method is associated with.
     *
     * For root resource methods,
     * specify the `RestApi` object.
     *
     * @experimental
     */
    readonly resource: IResource;
    /**
     * (experimental) The HTTP method ("GET", "POST", "PUT", ...) that clients use to call this method.
     *
     * @experimental
     */
    readonly httpMethod: string;
    /**
     * (experimental) The backend system that the method calls when it receives a request.
     *
     * @default - a new `MockIntegration`.
     * @experimental
     */
    readonly integration?: Integration;
    /**
     * (experimental) Method options.
     *
     * @default - No options.
     * @experimental
     */
    readonly options?: MethodOptions;
}
/**
 * @experimental
 */
export declare class Method extends Resource {
    /**
     * @experimental
     * @attribute true
     */
    readonly methodId: string;
    /**
     * @experimental
     */
    readonly httpMethod: string;
    /**
     * @experimental
     */
    readonly resource: IResource;
    /**
     * (experimental) The API Gateway RestApi associated with this method.
     *
     * @experimental
     */
    readonly api: IRestApi;
    /**
     * @experimental
     */
    constructor(scope: Construct, id: string, props: MethodProps);
    /**
     * (experimental) Returns an execute-api ARN for this method:.
     *
     * arn:aws:execute-api:{region}:{account}:{restApiId}/{stage}/{method}/{path}
     *
     * NOTE: {stage} will refer to the `restApi.deploymentStage`, which will
     * automatically set if auto-deploy is enabled, or can be explicitly assigned.
     * When not configured, {stage} will be set to '*', as a shorthand for 'all stages'.
     *
     * @experimental
     * @attribute true
     */
    get methodArn(): string;
    /**
     * (experimental) Returns an execute-api ARN for this method's "test-invoke-stage" stage.
     *
     * This stage is used by the AWS Console UI when testing the method.
     *
     * @experimental
     */
    get testMethodArn(): string;
    private renderIntegration;
    private renderMethodResponses;
    private renderRequestModels;
    private requestValidatorId;
}
/**
 * @experimental
 */
export declare enum AuthorizationType {
    /**
     * (experimental) Open access.
     *
     * @experimental
     */
    NONE = "NONE",
    /**
     * (experimental) Use AWS IAM permissions.
     *
     * @experimental
     */
    IAM = "AWS_IAM",
    /**
     * (experimental) Use a custom authorizer.
     *
     * @experimental
     */
    CUSTOM = "CUSTOM",
    /**
     * (experimental) Use an AWS Cognito user pool.
     *
     * @experimental
     */
    COGNITO = "COGNITO_USER_POOLS"
}
