Class Method
Provides a HTTP Method for an API Gateway Resource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
{
Description = "This is my API for demonstration purposes",
});
var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = myDemoAPI.RootResourceId,
PathPart = "mydemoresource",
RestApi = myDemoAPI.Id,
});
var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
{
Authorization = "NONE",
HttpMethod = "GET",
ResourceId = myDemoResource.Id,
RestApi = myDemoAPI.Id,
});
}
}
Usage with Cognito User Pool Authorizer
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var cognitoUserPoolName = config.RequireObject<dynamic>("cognitoUserPoolName");
var thisUserPools = Output.Create(Aws.Cognito.GetUserPools.InvokeAsync(new Aws.Cognito.GetUserPoolsArgs
{
Name = cognitoUserPoolName,
}));
var thisRestApi = new Aws.ApiGateway.RestApi("thisRestApi", new Aws.ApiGateway.RestApiArgs
{
});
var thisResource = new Aws.ApiGateway.Resource("thisResource", new Aws.ApiGateway.ResourceArgs
{
ParentId = thisRestApi.RootResourceId,
PathPart = "{proxy+}",
RestApi = thisRestApi.Id,
});
var thisAuthorizer = new Aws.ApiGateway.Authorizer("thisAuthorizer", new Aws.ApiGateway.AuthorizerArgs
{
ProviderArns = thisUserPools.Apply(thisUserPools => thisUserPools.Arns),
RestApi = thisRestApi.Id,
Type = "COGNITO_USER_POOLS",
});
var any = new Aws.ApiGateway.Method("any", new Aws.ApiGateway.MethodArgs
{
Authorization = "COGNITO_USER_POOLS",
AuthorizerId = thisAuthorizer.Id,
HttpMethod = "ANY",
RequestParameters =
{
{ "method.request.path.proxy", true },
},
ResourceId = thisResource.Id,
RestApi = thisRestApi.Id,
});
}
}
Inherited Members
Namespace: Pulumi.Aws.ApiGateway
Assembly: Pulumi.Aws.dll
Syntax
public class Method : CustomResource
Constructors
View SourceMethod(String, MethodArgs, CustomResourceOptions)
Create a Method resource with the given unique name, arguments, and options.
Declaration
public Method(string name, MethodArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| MethodArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceApiKeyRequired
Specify if the method requires an API key
Declaration
public Output<bool?> ApiKeyRequired { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Authorization
The type of authorization used for the method (NONE, CUSTOM, AWS_IAM, COGNITO_USER_POOLS)
Declaration
public Output<string> Authorization { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
AuthorizationScopes
The authorization scopes used when the authorization is COGNITO_USER_POOLS
Declaration
public Output<ImmutableArray<string>> AuthorizationScopes { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
AuthorizerId
The authorizer id to be used when the authorization is CUSTOM or COGNITO_USER_POOLS
Declaration
public Output<string> AuthorizerId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
HttpMethod
The HTTP Method (GET, POST, PUT, DELETE, HEAD, OPTIONS, ANY)
Declaration
public Output<string> HttpMethod { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RequestModels
A 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.
Declaration
public Output<ImmutableDictionary<string, string>> RequestModels { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>> |
RequestParameters
A 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: request_parameters = {"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.
Declaration
public Output<ImmutableDictionary<string, bool>> RequestParameters { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Boolean>> |
RequestValidatorId
The ID of a aws.apigateway.RequestValidator
Declaration
public Output<string> RequestValidatorId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ResourceId
The API resource ID
Declaration
public Output<string> ResourceId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RestApi
The ID of the associated REST API
Declaration
public Output<string> RestApi { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, MethodState, CustomResourceOptions)
Get an existing Method resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Method Get(string name, Input<string> id, MethodState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| MethodState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Method |