UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

272 lines (271 loc) • 11.1 kB
import * as pulumi from "@pulumi/pulumi"; import { RestApi } from "./index"; /** * Provides a HTTP Method for an API Gateway Resource. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const myDemoAPI = new aws.apigateway.RestApi("MyDemoAPI", { * name: "MyDemoAPI", * description: "This is my API for demonstration purposes", * }); * const myDemoResource = new aws.apigateway.Resource("MyDemoResource", { * restApi: myDemoAPI.id, * parentId: myDemoAPI.rootResourceId, * pathPart: "mydemoresource", * }); * const myDemoMethod = new aws.apigateway.Method("MyDemoMethod", { * restApi: myDemoAPI.id, * resourceId: myDemoResource.id, * httpMethod: "GET", * authorization: "NONE", * }); * ``` * * ## Usage with Cognito User Pool Authorizer * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const config = new pulumi.Config(); * const cognitoUserPoolName = config.requireObject<any>("cognitoUserPoolName"); * const _this = aws.cognito.getUserPools({ * name: cognitoUserPoolName, * }); * const thisRestApi = new aws.apigateway.RestApi("this", {name: "with-authorizer"}); * const thisResource = new aws.apigateway.Resource("this", { * restApi: thisRestApi.id, * parentId: thisRestApi.rootResourceId, * pathPart: "{proxy+}", * }); * const thisAuthorizer = new aws.apigateway.Authorizer("this", { * name: "CognitoUserPoolAuthorizer", * type: "COGNITO_USER_POOLS", * restApi: thisRestApi.id, * providerArns: _this.then(_this => _this.arns), * }); * const any = new aws.apigateway.Method("any", { * restApi: thisRestApi.id, * resourceId: thisResource.id, * httpMethod: "ANY", * authorization: "COGNITO_USER_POOLS", * authorizerId: thisAuthorizer.id, * requestParameters: { * "method.request.path.proxy": true, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import `aws_api_gateway_method` using `REST-API-ID/RESOURCE-ID/HTTP-METHOD`. For example: * * ```sh * $ pulumi import aws:apigateway/method:Method example 12345abcde/67890fghij/GET * ``` */ export declare class Method extends pulumi.CustomResource { /** * Get an existing Method resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: MethodState, opts?: pulumi.CustomResourceOptions): Method; /** * Returns true if the given object is an instance of Method. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Method; /** * Specify if the method requires an API key */ readonly apiKeyRequired: pulumi.Output<boolean | undefined>; /** * Type of authorization used for the method (`NONE`, `CUSTOM`, `AWS_IAM`, `COGNITO_USER_POOLS`) */ readonly authorization: pulumi.Output<string>; /** * Authorization scopes used when the authorization is `COGNITO_USER_POOLS` */ readonly authorizationScopes: pulumi.Output<string[] | undefined>; /** * Authorizer id to be used when the authorization is `CUSTOM` or `COGNITO_USER_POOLS` */ readonly authorizerId: pulumi.Output<string | undefined>; /** * HTTP Method (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`, `OPTIONS`, `ANY`) */ readonly httpMethod: pulumi.Output<string>; /** * Function name that will be given to the method when generating an SDK through API Gateway. If omitted, API Gateway will generate a function name based on the resource path and HTTP verb. */ readonly operationName: pulumi.Output<string | undefined>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output<string>; /** * Map of the API models used for the request's content type * where key is the content type (e.g., `application/json`) * and value is either `Error`, `Empty` (built-in models) or `aws.apigateway.Model`'s `name`. */ readonly requestModels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Map of request parameters (from the path, query string and headers) that should be passed to the integration. The boolean value indicates whether the parameter is required (`true`) or optional (`false`). * For example: `requestParameters = {"method.request.header.X-Some-Header" = true "method.request.querystring.some-query-param" = true}` would define that the header `X-Some-Header` and the query string `some-query-param` must be provided in the request. */ readonly requestParameters: pulumi.Output<{ [key: string]: boolean; } | undefined>; /** * ID of a `aws.apigateway.RequestValidator` */ readonly requestValidatorId: pulumi.Output<string | undefined>; /** * API resource ID */ readonly resourceId: pulumi.Output<string>; /** * ID of the associated REST API */ readonly restApi: pulumi.Output<string>; /** * Create a Method resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: MethodArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Method resources. */ export interface MethodState { /** * Specify if the method requires an API key */ apiKeyRequired?: pulumi.Input<boolean>; /** * Type of authorization used for the method (`NONE`, `CUSTOM`, `AWS_IAM`, `COGNITO_USER_POOLS`) */ authorization?: pulumi.Input<string>; /** * Authorization scopes used when the authorization is `COGNITO_USER_POOLS` */ authorizationScopes?: pulumi.Input<pulumi.Input<string>[]>; /** * Authorizer id to be used when the authorization is `CUSTOM` or `COGNITO_USER_POOLS` */ authorizerId?: pulumi.Input<string>; /** * HTTP Method (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`, `OPTIONS`, `ANY`) */ httpMethod?: pulumi.Input<string>; /** * Function name that will be given to the method when generating an SDK through API Gateway. If omitted, API Gateway will generate a function name based on the resource path and HTTP verb. */ operationName?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Map of the API models used for the request's content type * where key is the content type (e.g., `application/json`) * and value is either `Error`, `Empty` (built-in models) or `aws.apigateway.Model`'s `name`. */ requestModels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Map of request parameters (from the path, query string and headers) that should be passed to the integration. The boolean value indicates whether the parameter is required (`true`) or optional (`false`). * For example: `requestParameters = {"method.request.header.X-Some-Header" = true "method.request.querystring.some-query-param" = true}` would define that the header `X-Some-Header` and the query string `some-query-param` must be provided in the request. */ requestParameters?: pulumi.Input<{ [key: string]: pulumi.Input<boolean>; }>; /** * ID of a `aws.apigateway.RequestValidator` */ requestValidatorId?: pulumi.Input<string>; /** * API resource ID */ resourceId?: pulumi.Input<string>; /** * ID of the associated REST API */ restApi?: pulumi.Input<string | RestApi>; } /** * The set of arguments for constructing a Method resource. */ export interface MethodArgs { /** * Specify if the method requires an API key */ apiKeyRequired?: pulumi.Input<boolean>; /** * Type of authorization used for the method (`NONE`, `CUSTOM`, `AWS_IAM`, `COGNITO_USER_POOLS`) */ authorization: pulumi.Input<string>; /** * Authorization scopes used when the authorization is `COGNITO_USER_POOLS` */ authorizationScopes?: pulumi.Input<pulumi.Input<string>[]>; /** * Authorizer id to be used when the authorization is `CUSTOM` or `COGNITO_USER_POOLS` */ authorizerId?: pulumi.Input<string>; /** * HTTP Method (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`, `OPTIONS`, `ANY`) */ httpMethod: pulumi.Input<string>; /** * Function name that will be given to the method when generating an SDK through API Gateway. If omitted, API Gateway will generate a function name based on the resource path and HTTP verb. */ operationName?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Map of the API models used for the request's content type * where key is the content type (e.g., `application/json`) * and value is either `Error`, `Empty` (built-in models) or `aws.apigateway.Model`'s `name`. */ requestModels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Map of request parameters (from the path, query string and headers) that should be passed to the integration. The boolean value indicates whether the parameter is required (`true`) or optional (`false`). * For example: `requestParameters = {"method.request.header.X-Some-Header" = true "method.request.querystring.some-query-param" = true}` would define that the header `X-Some-Header` and the query string `some-query-param` must be provided in the request. */ requestParameters?: pulumi.Input<{ [key: string]: pulumi.Input<boolean>; }>; /** * ID of a `aws.apigateway.RequestValidator` */ requestValidatorId?: pulumi.Input<string>; /** * API resource ID */ resourceId: pulumi.Input<string>; /** * ID of the associated REST API */ restApi: pulumi.Input<string | RestApi>; }