Skip to content

Commit

Permalink
docs: README
Browse files Browse the repository at this point in the history
  • Loading branch information
badmintoncryer committed Dec 21, 2023
1 parent b8cf39b commit 1ad6947
Showing 1 changed file with 41 additions and 14 deletions.
55 changes: 41 additions & 14 deletions packages/aws-cdk-lib/aws-apigatewayv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@

## Table of Contents

- [Introduction](#introduction)
- [HTTP API](#http-api)
- [Defining HTTP APIs](#defining-http-apis)
- [Cross Origin Resource Sharing (CORS)](#cross-origin-resource-sharing-cors)
- [Publishing HTTP APIs](#publishing-http-apis)
- [Custom Domain](#custom-domain)
- [Mutual TLS](#mutual-tls-mtls)
- [Managing access to HTTP APIs](#managing-access-to-http-apis)
- [Metrics](#metrics)
- [VPC Link](#vpc-link)
- [Private Integration](#private-integration)
- [WebSocket API](#websocket-api)
- [Manage Connections Permission](#manage-connections-permission)
- [Managing access to WebSocket APIs](#managing-access-to-websocket-apis)
- [AWS APIGatewayv2 Construct Library](#aws-apigatewayv2-construct-library)
- [Table of Contents](#table-of-contents)
- [Introduction](#introduction)
- [HTTP API](#http-api)
- [Defining HTTP APIs](#defining-http-apis)
- [Cross Origin Resource Sharing (CORS)](#cross-origin-resource-sharing-cors)
- [Publishing HTTP APIs](#publishing-http-apis)
- [Custom Domain](#custom-domain)
- [Mutual TLS (mTLS)](#mutual-tls-mtls)
- [Managing access to HTTP APIs](#managing-access-to-http-apis)
- [Metrics](#metrics)
- [VPC Link](#vpc-link)
- [Private Integration](#private-integration)
- [Generating ARN for Execute API](#generating-arn-for-execute-api)
- [WebSocket API](#websocket-api)
- [Manage Connections Permission](#manage-connections-permission)
- [Managing access to WebSocket APIs](#managing-access-to-websocket-apis)
- [API Keys](#api-keys)

## Introduction

Expand Down Expand Up @@ -325,6 +329,19 @@ clients outside of the VPC.

These integrations can be found in the [aws-apigatewayv2-integrations](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2_integrations-readme.html) constructs library.

### Generating ARN for Execute API

The arnForExecuteApi function in AWS CDK is designed to generate Amazon Resource Names (ARNs) for Execute API operations. This is particularly useful when you need to create ARNs dynamically based on different parameters like HTTP method, API path, and stage.

```ts
const api = new apigwv2.HttpApi(this, 'my-api');
const arn = api.arnForExecuteApi('GET', '/myApiPath', 'dev');
```

- Ensure that the path parameter, if provided, starts with '/'.
- The 'ANY' method can be used for matching any HTTP methods not explicitly defined.
- The function gracefully handles undefined parameters by using wildcards, making it flexible for various API configurations.

## WebSocket API

A WebSocket API in API Gateway is a collection of WebSocket routes that are integrated with backend HTTP endpoints,
Expand Down Expand Up @@ -405,6 +422,16 @@ To import an existing WebSocketApi:
const webSocketApi = apigwv2.WebSocketApi.fromWebSocketApiAttributes(this, 'mywsapi', { webSocketId: 'api-1234' });
```

To generate an ARN for Execute API:

```ts
const api = new apigwv2.WebSocketApi(this, 'mywsapi');
const arn = api.arnForExecuteApi('GET', '/myApiPath', 'dev');
```

For a detailed explanation of this function, including usage and examples, please refer to the [Generating ARN for Execute API](#generating-arn-for-execute-api) section under HTTP API.


### Manage Connections Permission

Grant permission to use API Gateway Management API of a WebSocket API by calling the `grantManageConnections` API.
Expand Down

0 comments on commit 1ad6947

Please sign in to comment.