@aws-solutions-constructs/core
Version:
Core CDK Construct for patterns library
67 lines (66 loc) • 2.98 kB
TypeScript
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
import * as apigwv2 from "aws-cdk-lib/aws-apigatewayv2";
import * as iam from "aws-cdk-lib/aws-iam";
import * as logs from "aws-cdk-lib/aws-logs";
import * as sqs from "aws-cdk-lib/aws-sqs";
import { Construct } from "constructs";
export interface BuildWebSocketQueueApiResponse {
readonly webSocketApi: apigwv2.WebSocketApi;
readonly webSocketStage: apigwv2.WebSocketStage;
readonly apiGatewayRole: iam.Role;
readonly apiGatewayLogGroup: logs.LogGroup;
}
export interface BuildWebSocketApiProps {
/**
* Existing instance of ApiGateway v2 WebSocket
*/
readonly existingWebSocketApi?: apigwv2.WebSocketApi;
/**
* User provided properties of Apigateway v2 WebSocket
*/
readonly webSocketApiProps?: apigwv2.WebSocketApiProps;
}
export interface BuildWebSocketQueueApiRequest {
readonly queue: sqs.IQueue;
readonly defaultRouteRequestTemplate?: {
[contentType: string]: string;
};
readonly createDefaultRoute?: boolean;
readonly webSocketApiProps?: apigwv2.WebSocketApiProps;
readonly existingWebSocketApi?: apigwv2.WebSocketApi;
readonly logGroupProps?: logs.LogGroupProps;
readonly defaultIamAuthorization?: boolean;
readonly customRouteName?: string;
}
/**
* Builds an AWS API Gateway WebSocket API integrated with an Amazon SQS queue.
*
* @param scope The construct scope where the resources will be created.
* @param id The unique ID for the resources.
* @param props The configuration properties for the WebSocket API and SQS queue integration.
* @returns
*/
export declare function buildWebSocketQueueApi(scope: Construct, id: string, props: BuildWebSocketQueueApiRequest): BuildWebSocketQueueApiResponse;
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*/
export declare function buildWebSocketApiProps(role?: iam.Role, sqsQueue?: sqs.IQueue, createDefaultRoute?: boolean, requestTemplate?: {
[contentType: string]: string;
}, defaultIamAuthorization?: boolean): apigwv2.WebSocketApiProps;
/**
* @internal This is an internal core function and should not be called directly by Solutions Constructs clients.
*/
export declare function buildWebSocketQueueRouteOptions(role: iam.Role, sqsQueue: sqs.IQueue, routeName: string, requestTemplate?: {
[contentType: string]: string;
}): apigwv2.WebSocketRouteOptions;