aws.apigateway.Method
Explore with Pulumi AI
Provides a HTTP Method for an API Gateway Resource.
Example Usage
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",
});
import pulumi
import pulumi_aws as aws
my_demo_api = aws.apigateway.RestApi("MyDemoAPI",
name="MyDemoAPI",
description="This is my API for demonstration purposes")
my_demo_resource = aws.apigateway.Resource("MyDemoResource",
rest_api=my_demo_api.id,
parent_id=my_demo_api.root_resource_id,
path_part="mydemoresource")
my_demo_method = aws.apigateway.Method("MyDemoMethod",
rest_api=my_demo_api.id,
resource_id=my_demo_resource.id,
http_method="GET",
authorization="NONE")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myDemoAPI, err := apigateway.NewRestApi(ctx, "MyDemoAPI", &apigateway.RestApiArgs{
Name: pulumi.String("MyDemoAPI"),
Description: pulumi.String("This is my API for demonstration purposes"),
})
if err != nil {
return err
}
myDemoResource, err := apigateway.NewResource(ctx, "MyDemoResource", &apigateway.ResourceArgs{
RestApi: myDemoAPI.ID(),
ParentId: myDemoAPI.RootResourceId,
PathPart: pulumi.String("mydemoresource"),
})
if err != nil {
return err
}
_, err = apigateway.NewMethod(ctx, "MyDemoMethod", &apigateway.MethodArgs{
RestApi: myDemoAPI.ID(),
ResourceId: myDemoResource.ID(),
HttpMethod: pulumi.String("GET"),
Authorization: pulumi.String("NONE"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var myDemoAPI = new Aws.ApiGateway.RestApi("MyDemoAPI", new()
{
Name = "MyDemoAPI",
Description = "This is my API for demonstration purposes",
});
var myDemoResource = new Aws.ApiGateway.Resource("MyDemoResource", new()
{
RestApi = myDemoAPI.Id,
ParentId = myDemoAPI.RootResourceId,
PathPart = "mydemoresource",
});
var myDemoMethod = new Aws.ApiGateway.Method("MyDemoMethod", new()
{
RestApi = myDemoAPI.Id,
ResourceId = myDemoResource.Id,
HttpMethod = "GET",
Authorization = "NONE",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.RestApi;
import com.pulumi.aws.apigateway.RestApiArgs;
import com.pulumi.aws.apigateway.Resource;
import com.pulumi.aws.apigateway.ResourceArgs;
import com.pulumi.aws.apigateway.Method;
import com.pulumi.aws.apigateway.MethodArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var myDemoAPI = new RestApi("myDemoAPI", RestApiArgs.builder()
.name("MyDemoAPI")
.description("This is my API for demonstration purposes")
.build());
var myDemoResource = new Resource("myDemoResource", ResourceArgs.builder()
.restApi(myDemoAPI.id())
.parentId(myDemoAPI.rootResourceId())
.pathPart("mydemoresource")
.build());
var myDemoMethod = new Method("myDemoMethod", MethodArgs.builder()
.restApi(myDemoAPI.id())
.resourceId(myDemoResource.id())
.httpMethod("GET")
.authorization("NONE")
.build());
}
}
resources:
myDemoAPI:
type: aws:apigateway:RestApi
name: MyDemoAPI
properties:
name: MyDemoAPI
description: This is my API for demonstration purposes
myDemoResource:
type: aws:apigateway:Resource
name: MyDemoResource
properties:
restApi: ${myDemoAPI.id}
parentId: ${myDemoAPI.rootResourceId}
pathPart: mydemoresource
myDemoMethod:
type: aws:apigateway:Method
name: MyDemoMethod
properties:
restApi: ${myDemoAPI.id}
resourceId: ${myDemoResource.id}
httpMethod: GET
authorization: NONE
Usage with Cognito User Pool Authorizer
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const config = new pulumi.Config();
const cognitoUserPoolName = config.requireObject("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 pulumi
import pulumi_aws as aws
config = pulumi.Config()
cognito_user_pool_name = config.require_object("cognitoUserPoolName")
this = aws.cognito.get_user_pools(name=cognito_user_pool_name)
this_rest_api = aws.apigateway.RestApi("this", name="with-authorizer")
this_resource = aws.apigateway.Resource("this",
rest_api=this_rest_api.id,
parent_id=this_rest_api.root_resource_id,
path_part="{proxy+}")
this_authorizer = aws.apigateway.Authorizer("this",
name="CognitoUserPoolAuthorizer",
type="COGNITO_USER_POOLS",
rest_api=this_rest_api.id,
provider_arns=this.arns)
any = aws.apigateway.Method("any",
rest_api=this_rest_api.id,
resource_id=this_resource.id,
http_method="ANY",
authorization="COGNITO_USER_POOLS",
authorizer_id=this_authorizer.id,
request_parameters={
"method.request.path.proxy": True,
})
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
cognitoUserPoolName := cfg.RequireObject("cognitoUserPoolName")
this, err := cognito.GetUserPools(ctx, &cognito.GetUserPoolsArgs{
Name: cognitoUserPoolName,
}, nil)
if err != nil {
return err
}
thisRestApi, err := apigateway.NewRestApi(ctx, "this", &apigateway.RestApiArgs{
Name: pulumi.String("with-authorizer"),
})
if err != nil {
return err
}
thisResource, err := apigateway.NewResource(ctx, "this", &apigateway.ResourceArgs{
RestApi: thisRestApi.ID(),
ParentId: thisRestApi.RootResourceId,
PathPart: pulumi.String("{proxy+}"),
})
if err != nil {
return err
}
thisAuthorizer, err := apigateway.NewAuthorizer(ctx, "this", &apigateway.AuthorizerArgs{
Name: pulumi.String("CognitoUserPoolAuthorizer"),
Type: pulumi.String("COGNITO_USER_POOLS"),
RestApi: thisRestApi.ID(),
ProviderArns: interface{}(this.Arns),
})
if err != nil {
return err
}
_, err = apigateway.NewMethod(ctx, "any", &apigateway.MethodArgs{
RestApi: thisRestApi.ID(),
ResourceId: thisResource.ID(),
HttpMethod: pulumi.String("ANY"),
Authorization: pulumi.String("COGNITO_USER_POOLS"),
AuthorizerId: thisAuthorizer.ID(),
RequestParameters: pulumi.BoolMap{
"method.request.path.proxy": pulumi.Bool(true),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var cognitoUserPoolName = config.RequireObject<dynamic>("cognitoUserPoolName");
var @this = Aws.Cognito.GetUserPools.Invoke(new()
{
Name = cognitoUserPoolName,
});
var thisRestApi = new Aws.ApiGateway.RestApi("this", new()
{
Name = "with-authorizer",
});
var thisResource = new Aws.ApiGateway.Resource("this", new()
{
RestApi = thisRestApi.Id,
ParentId = thisRestApi.RootResourceId,
PathPart = "{proxy+}",
});
var thisAuthorizer = new Aws.ApiGateway.Authorizer("this", new()
{
Name = "CognitoUserPoolAuthorizer",
Type = "COGNITO_USER_POOLS",
RestApi = thisRestApi.Id,
ProviderArns = @this.Apply(@this => @this.Apply(getUserPoolsResult => getUserPoolsResult.Arns)),
});
var any = new Aws.ApiGateway.Method("any", new()
{
RestApi = thisRestApi.Id,
ResourceId = thisResource.Id,
HttpMethod = "ANY",
Authorization = "COGNITO_USER_POOLS",
AuthorizerId = thisAuthorizer.Id,
RequestParameters =
{
{ "method.request.path.proxy", true },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cognito.CognitoFunctions;
import com.pulumi.aws.cognito.inputs.GetUserPoolsArgs;
import com.pulumi.aws.apigateway.RestApi;
import com.pulumi.aws.apigateway.RestApiArgs;
import com.pulumi.aws.apigateway.Resource;
import com.pulumi.aws.apigateway.ResourceArgs;
import com.pulumi.aws.apigateway.Authorizer;
import com.pulumi.aws.apigateway.AuthorizerArgs;
import com.pulumi.aws.apigateway.Method;
import com.pulumi.aws.apigateway.MethodArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var cognitoUserPoolName = config.get("cognitoUserPoolName");
final var this = CognitoFunctions.getUserPools(GetUserPoolsArgs.builder()
.name(cognitoUserPoolName)
.build());
var thisRestApi = new RestApi("thisRestApi", RestApiArgs.builder()
.name("with-authorizer")
.build());
var thisResource = new Resource("thisResource", ResourceArgs.builder()
.restApi(thisRestApi.id())
.parentId(thisRestApi.rootResourceId())
.pathPart("{proxy+}")
.build());
var thisAuthorizer = new Authorizer("thisAuthorizer", AuthorizerArgs.builder()
.name("CognitoUserPoolAuthorizer")
.type("COGNITO_USER_POOLS")
.restApi(thisRestApi.id())
.providerArns(this_.arns())
.build());
var any = new Method("any", MethodArgs.builder()
.restApi(thisRestApi.id())
.resourceId(thisResource.id())
.httpMethod("ANY")
.authorization("COGNITO_USER_POOLS")
.authorizerId(thisAuthorizer.id())
.requestParameters(Map.of("method.request.path.proxy", true))
.build());
}
}
configuration:
cognitoUserPoolName:
type: dynamic
resources:
thisRestApi:
type: aws:apigateway:RestApi
name: this
properties:
name: with-authorizer
thisResource:
type: aws:apigateway:Resource
name: this
properties:
restApi: ${thisRestApi.id}
parentId: ${thisRestApi.rootResourceId}
pathPart: '{proxy+}'
thisAuthorizer:
type: aws:apigateway:Authorizer
name: this
properties:
name: CognitoUserPoolAuthorizer
type: COGNITO_USER_POOLS
restApi: ${thisRestApi.id}
providerArns: ${this.arns}
any:
type: aws:apigateway:Method
properties:
restApi: ${thisRestApi.id}
resourceId: ${thisResource.id}
httpMethod: ANY
authorization: COGNITO_USER_POOLS
authorizerId: ${thisAuthorizer.id}
requestParameters:
method.request.path.proxy: true
variables:
this:
fn::invoke:
Function: aws:cognito:getUserPools
Arguments:
name: ${cognitoUserPoolName}
Create Method Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Method(name: string, args: MethodArgs, opts?: CustomResourceOptions);
@overload
def Method(resource_name: str,
args: MethodArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Method(resource_name: str,
opts: Optional[ResourceOptions] = None,
authorization: Optional[str] = None,
http_method: Optional[str] = None,
resource_id: Optional[str] = None,
rest_api: Optional[str] = None,
api_key_required: Optional[bool] = None,
authorization_scopes: Optional[Sequence[str]] = None,
authorizer_id: Optional[str] = None,
operation_name: Optional[str] = None,
request_models: Optional[Mapping[str, str]] = None,
request_parameters: Optional[Mapping[str, bool]] = None,
request_validator_id: Optional[str] = None)
func NewMethod(ctx *Context, name string, args MethodArgs, opts ...ResourceOption) (*Method, error)
public Method(string name, MethodArgs args, CustomResourceOptions? opts = null)
public Method(String name, MethodArgs args)
public Method(String name, MethodArgs args, CustomResourceOptions options)
type: aws:apigateway:Method
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args MethodArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MethodArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MethodArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MethodArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MethodArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var methodResource = new Aws.ApiGateway.Method("methodResource", new()
{
Authorization = "string",
HttpMethod = "string",
ResourceId = "string",
RestApi = "string",
ApiKeyRequired = false,
AuthorizationScopes = new[]
{
"string",
},
AuthorizerId = "string",
OperationName = "string",
RequestModels =
{
{ "string", "string" },
},
RequestParameters =
{
{ "string", false },
},
RequestValidatorId = "string",
});
example, err := apigateway.NewMethod(ctx, "methodResource", &apigateway.MethodArgs{
Authorization: pulumi.String("string"),
HttpMethod: pulumi.String("string"),
ResourceId: pulumi.String("string"),
RestApi: pulumi.Any("string"),
ApiKeyRequired: pulumi.Bool(false),
AuthorizationScopes: pulumi.StringArray{
pulumi.String("string"),
},
AuthorizerId: pulumi.String("string"),
OperationName: pulumi.String("string"),
RequestModels: pulumi.StringMap{
"string": pulumi.String("string"),
},
RequestParameters: pulumi.BoolMap{
"string": pulumi.Bool(false),
},
RequestValidatorId: pulumi.String("string"),
})
var methodResource = new Method("methodResource", MethodArgs.builder()
.authorization("string")
.httpMethod("string")
.resourceId("string")
.restApi("string")
.apiKeyRequired(false)
.authorizationScopes("string")
.authorizerId("string")
.operationName("string")
.requestModels(Map.of("string", "string"))
.requestParameters(Map.of("string", false))
.requestValidatorId("string")
.build());
method_resource = aws.apigateway.Method("methodResource",
authorization="string",
http_method="string",
resource_id="string",
rest_api="string",
api_key_required=False,
authorization_scopes=["string"],
authorizer_id="string",
operation_name="string",
request_models={
"string": "string",
},
request_parameters={
"string": False,
},
request_validator_id="string")
const methodResource = new aws.apigateway.Method("methodResource", {
authorization: "string",
httpMethod: "string",
resourceId: "string",
restApi: "string",
apiKeyRequired: false,
authorizationScopes: ["string"],
authorizerId: "string",
operationName: "string",
requestModels: {
string: "string",
},
requestParameters: {
string: false,
},
requestValidatorId: "string",
});
type: aws:apigateway:Method
properties:
apiKeyRequired: false
authorization: string
authorizationScopes:
- string
authorizerId: string
httpMethod: string
operationName: string
requestModels:
string: string
requestParameters:
string: false
requestValidatorId: string
resourceId: string
restApi: string
Method Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Method resource accepts the following input properties:
- string
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - Http
Method string - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - Resource
Id string - API resource ID
- Rest
Api string | string - ID of the associated REST API
- Api
Key boolRequired - Specify if the method requires an API key
- List<string>
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- string
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- Operation
Name 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.
- Request
Models Dictionary<string, 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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - Request
Parameters Dictionary<string, bool> - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - Request
Validator stringId - ID of a
aws.apigateway.RequestValidator
- string
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - Http
Method string - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - Resource
Id string - API resource ID
- Rest
Api string | string - ID of the associated REST API
- Api
Key boolRequired - Specify if the method requires an API key
- []string
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- string
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- Operation
Name 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.
- Request
Models map[string]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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - Request
Parameters map[string]bool - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - Request
Validator stringId - ID of a
aws.apigateway.RequestValidator
- String
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - http
Method String - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - resource
Id String - API resource ID
- rest
Api String | String - ID of the associated REST API
- api
Key BooleanRequired - Specify if the method requires an API key
- List<String>
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- String
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- operation
Name 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.
- request
Models Map<String,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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - request
Parameters Map<String,Boolean> - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - request
Validator StringId - ID of a
aws.apigateway.RequestValidator
- string
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - http
Method string - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - resource
Id string - API resource ID
- rest
Api string | RestApi - ID of the associated REST API
- api
Key booleanRequired - Specify if the method requires an API key
- string[]
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- string
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- operation
Name 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.
- request
Models {[key: string]: 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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - request
Parameters {[key: string]: boolean} - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - request
Validator stringId - ID of a
aws.apigateway.RequestValidator
- str
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - http_
method str - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - resource_
id str - API resource ID
- rest_
api str | str - ID of the associated REST API
- api_
key_ boolrequired - Specify if the method requires an API key
- Sequence[str]
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- str
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- operation_
name str - 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.
- request_
models Mapping[str, str] - 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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - request_
parameters Mapping[str, bool] - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - request_
validator_ strid - ID of a
aws.apigateway.RequestValidator
- String
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - http
Method String - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - resource
Id String - API resource ID
- rest
Api String | - ID of the associated REST API
- api
Key BooleanRequired - Specify if the method requires an API key
- List<String>
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- String
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- operation
Name 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.
- request
Models Map<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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - request
Parameters Map<Boolean> - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - request
Validator StringId - ID of a
aws.apigateway.RequestValidator
Outputs
All input properties are implicitly available as output properties. Additionally, the Method resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Method Resource
Get an existing Method resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: MethodState, opts?: CustomResourceOptions): Method
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
api_key_required: Optional[bool] = None,
authorization: Optional[str] = None,
authorization_scopes: Optional[Sequence[str]] = None,
authorizer_id: Optional[str] = None,
http_method: Optional[str] = None,
operation_name: Optional[str] = None,
request_models: Optional[Mapping[str, str]] = None,
request_parameters: Optional[Mapping[str, bool]] = None,
request_validator_id: Optional[str] = None,
resource_id: Optional[str] = None,
rest_api: Optional[str] = None) -> Method
func GetMethod(ctx *Context, name string, id IDInput, state *MethodState, opts ...ResourceOption) (*Method, error)
public static Method Get(string name, Input<string> id, MethodState? state, CustomResourceOptions? opts = null)
public static Method get(String name, Output<String> id, MethodState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Api
Key boolRequired - Specify if the method requires an API key
- string
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - List<string>
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- string
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- Http
Method string - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - Operation
Name 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.
- Request
Models Dictionary<string, 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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - Request
Parameters Dictionary<string, bool> - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - Request
Validator stringId - ID of a
aws.apigateway.RequestValidator
- Resource
Id string - API resource ID
- Rest
Api string | string - ID of the associated REST API
- Api
Key boolRequired - Specify if the method requires an API key
- string
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - []string
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- string
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- Http
Method string - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - Operation
Name 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.
- Request
Models map[string]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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - Request
Parameters map[string]bool - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - Request
Validator stringId - ID of a
aws.apigateway.RequestValidator
- Resource
Id string - API resource ID
- Rest
Api string | string - ID of the associated REST API
- api
Key BooleanRequired - Specify if the method requires an API key
- String
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - List<String>
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- String
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- http
Method String - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - operation
Name 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.
- request
Models Map<String,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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - request
Parameters Map<String,Boolean> - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - request
Validator StringId - ID of a
aws.apigateway.RequestValidator
- resource
Id String - API resource ID
- rest
Api String | String - ID of the associated REST API
- api
Key booleanRequired - Specify if the method requires an API key
- string
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - string[]
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- string
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- http
Method string - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - operation
Name 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.
- request
Models {[key: string]: 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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - request
Parameters {[key: string]: boolean} - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - request
Validator stringId - ID of a
aws.apigateway.RequestValidator
- resource
Id string - API resource ID
- rest
Api string | RestApi - ID of the associated REST API
- api_
key_ boolrequired - Specify if the method requires an API key
- str
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - Sequence[str]
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- str
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- http_
method str - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - operation_
name str - 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.
- request_
models Mapping[str, str] - 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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - request_
parameters Mapping[str, bool] - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - request_
validator_ strid - ID of a
aws.apigateway.RequestValidator
- resource_
id str - API resource ID
- rest_
api str | str - ID of the associated REST API
- api
Key BooleanRequired - Specify if the method requires an API key
- String
- Type of authorization used for the method (
NONE
,CUSTOM
,AWS_IAM
,COGNITO_USER_POOLS
) - List<String>
- Authorization scopes used when the authorization is
COGNITO_USER_POOLS
- String
- Authorizer id to be used when the authorization is
CUSTOM
orCOGNITO_USER_POOLS
- http
Method String - HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
) - operation
Name 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.
- request
Models Map<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 eitherError
,Empty
(built-in models) oraws.apigateway.Model
'sname
. - request
Parameters Map<Boolean> - 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 headerX-Some-Header
and the query stringsome-query-param
must be provided in the request. - request
Validator StringId - ID of a
aws.apigateway.RequestValidator
- resource
Id String - API resource ID
- rest
Api String | - ID of the associated REST API
Import
Using pulumi import
, import aws_api_gateway_method
using REST-API-ID/RESOURCE-ID/HTTP-METHOD
. For example:
$ pulumi import aws:apigateway/method:Method example 12345abcde/67890fghij/GET
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.