Class Api
Manages an Amazon API Gateway Version 2 API.
Note: Amazon API Gateway Version 2 resources are used for creating and deploying WebSocket and HTTP APIs. To create and deploy REST APIs, use Amazon API Gateway Version 1.
Example Usage
Basic WebSocket API
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Api("example", new Aws.ApiGatewayV2.ApiArgs
{
ProtocolType = "WEBSOCKET",
RouteSelectionExpression = "$$request.body.action",
});
}
}
Basic HTTP API
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ApiGatewayV2.Api("example", new Aws.ApiGatewayV2.ApiArgs
{
ProtocolType = "HTTP",
});
}
}
Inherited Members
Namespace: Pulumi.Aws.ApiGatewayV2
Assembly: Pulumi.Aws.dll
Syntax
public class Api : CustomResource
Constructors
View SourceApi(String, ApiArgs, CustomResourceOptions)
Create a Api resource with the given unique name, arguments, and options.
Declaration
public Api(string name, ApiArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| ApiArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceApiEndpoint
The URI of the API, of the form {api-id}.execute-api.{region}.amazonaws.com.
Declaration
public Output<string> ApiEndpoint { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ApiKeySelectionExpression
An API key selection expression.
Valid values: $context.authorizer.usageIdentifierKey, $request.header.x-api-key. Defaults to $request.header.x-api-key.
Applicable for WebSocket APIs.
Declaration
public Output<string> ApiKeySelectionExpression { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Arn
The ARN of the API.
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
CorsConfiguration
The cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.
Declaration
public Output<ApiCorsConfiguration> CorsConfiguration { get; }
Property Value
| Type | Description |
|---|---|
| Output<ApiCorsConfiguration> |
CredentialsArn
Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.
Declaration
public Output<string> CredentialsArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Description
The description of the API.
Declaration
public Output<string> Description { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ExecutionArn
The ARN prefix to be used in an aws.lambda.Permission's source_arn attribute
or in an aws.iam.Policy to authorize access to the @connections API.
See the Amazon API Gateway Developer Guide for details.
Declaration
public Output<string> ExecutionArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
The name of the API.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ProtocolType
The API protocol. Valid values: HTTP, WEBSOCKET.
Declaration
public Output<string> ProtocolType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RouteKey
Part of quick create. Specifies any route key. Applicable for HTTP APIs.
Declaration
public Output<string> RouteKey { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RouteSelectionExpression
The route selection expression for the API.
Defaults to $request.method $request.path.
Declaration
public Output<string> RouteSelectionExpression { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Tags
A map of tags to assign to the API.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
Target
Part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes.
For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN.
The type of the integration will be HTTP_PROXY or AWS_PROXY, respectively. Applicable for HTTP APIs.
Declaration
public Output<string> Target { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Version
A version identifier for the API.
Declaration
public Output<string> Version { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, ApiState, CustomResourceOptions)
Get an existing Api resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Api Get(string name, Input<string> id, ApiState 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. |
| ApiState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Api |