ApiArgs

data class ApiArgs(val apiKeySelectionExpression: Output<String>? = null, val body: Output<String>? = null, val corsConfiguration: Output<ApiCorsConfigurationArgs>? = null, val credentialsArn: Output<String>? = null, val description: Output<String>? = null, val disableExecuteApiEndpoint: Output<Boolean>? = null, val failOnWarnings: Output<Boolean>? = null, val name: Output<String>? = null, val protocolType: Output<String>? = null, val routeKey: Output<String>? = null, val routeSelectionExpression: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val target: Output<String>? = null, val version: Output<String>? = null) : ConvertibleToJava<ApiArgs>

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 resources.

Example Usage

Basic WebSocket API

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigatewayv2.Api;
import com.pulumi.aws.apigatewayv2.ApiArgs;
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 example = new Api("example", ApiArgs.builder()
.protocolType("WEBSOCKET")
.routeSelectionExpression("$request.body.action")
.build());
}
}

Basic HTTP API

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigatewayv2.Api;
import com.pulumi.aws.apigatewayv2.ApiArgs;
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 example = new Api("example", ApiArgs.builder()
.protocolType("HTTP")
.build());
}
}

Import

aws_apigatewayv2_api can be imported by using the API identifier, e.g.,

$ pulumi import aws:apigatewayv2/api:Api example aabbccddee

Constructors

Link copied to clipboard
constructor(apiKeySelectionExpression: Output<String>? = null, body: Output<String>? = null, corsConfiguration: Output<ApiCorsConfigurationArgs>? = null, credentialsArn: Output<String>? = null, description: Output<String>? = null, disableExecuteApiEndpoint: Output<Boolean>? = null, failOnWarnings: Output<Boolean>? = null, name: Output<String>? = null, protocolType: Output<String>? = null, routeKey: Output<String>? = null, routeSelectionExpression: Output<String>? = null, tags: Output<Map<String, String>>? = null, target: Output<String>? = null, version: Output<String>? = null)

Properties

Link copied to clipboard
val apiKeySelectionExpression: Output<String>? = null

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.

Link copied to clipboard
val body: Output<String>? = null

An OpenAPI specification that defines the set of routes and integrations to create as part of the HTTP APIs. Supported only for HTTP APIs.

Link copied to clipboard

Cross-origin resource sharing (CORS) configuration. Applicable for HTTP APIs.

Link copied to clipboard
val credentialsArn: Output<String>? = null

Part of quick create. Specifies any credentials required for the integration. Applicable for HTTP APIs.

Link copied to clipboard
val description: Output<String>? = null

Description of the API. Must be less than or equal to 1024 characters in length.

Link copied to clipboard
val disableExecuteApiEndpoint: Output<Boolean>? = null

Whether clients can invoke the API by using the default execute-api endpoint. By default, clients can invoke the API with the default {api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke the API, disable the default endpoint.

Link copied to clipboard
val failOnWarnings: Output<Boolean>? = null

Whether warnings should return an error while API Gateway is creating or updating the resource using an OpenAPI specification. Defaults to false. Applicable for HTTP APIs.

Link copied to clipboard
val name: Output<String>? = null

Name of the API. Must be less than or equal to 128 characters in length.

Link copied to clipboard
val protocolType: Output<String>? = null

API protocol. Valid values: HTTP, WEBSOCKET.

Link copied to clipboard
val routeKey: Output<String>? = null

Part of quick create. Specifies any route key. Applicable for HTTP APIs.

Link copied to clipboard
val routeSelectionExpression: Output<String>? = null

The route selection expression for the API. Defaults to $request.method $request.path.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Map of tags to assign to the API. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val target: Output<String>? = null

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.

Link copied to clipboard
val version: Output<String>? = null

Version identifier for the API. Must be between 1 and 64 characters in length.

Functions

Link copied to clipboard
open override fun toJava(): ApiArgs