feat: add SQS + EventBridge
This commit is contained in:
@@ -245,6 +245,60 @@ export interface ApiGatewayRoutesResult {
|
||||
stages: string[];
|
||||
}
|
||||
|
||||
export interface DeleteApiGatewayRouteInput {
|
||||
resourceId: string;
|
||||
path: string;
|
||||
method: string;
|
||||
stage: string;
|
||||
}
|
||||
|
||||
export interface CreateS3LambdaTriggerInput {
|
||||
functionName: string;
|
||||
events: string[];
|
||||
prefix?: string;
|
||||
suffix?: string;
|
||||
}
|
||||
|
||||
export interface S3LambdaTriggerOverview {
|
||||
id: string;
|
||||
functionName: string;
|
||||
functionArn: string;
|
||||
events: string[];
|
||||
prefix: string | null;
|
||||
suffix: string | null;
|
||||
}
|
||||
|
||||
export interface CreateEventBridgeLambdaTriggerInput {
|
||||
ruleName: string;
|
||||
scheduleExpression: string;
|
||||
}
|
||||
|
||||
export interface EventBridgeLambdaTriggerOverview {
|
||||
id: string;
|
||||
ruleName: string;
|
||||
ruleArn: string;
|
||||
functionName: string;
|
||||
functionArn: string;
|
||||
scheduleExpression: string;
|
||||
state: string | null;
|
||||
}
|
||||
|
||||
export interface CreateSqsLambdaEventSourceMappingInput {
|
||||
queueArn: string;
|
||||
batchSize?: number;
|
||||
}
|
||||
|
||||
export interface SqsLambdaEventSourceMappingOverview {
|
||||
id: string;
|
||||
uuid: string;
|
||||
functionName: string;
|
||||
functionArn: string | null;
|
||||
queueArn: string;
|
||||
batchSize: number | null;
|
||||
state: string | null;
|
||||
stateTransitionReason: string | null;
|
||||
}
|
||||
|
||||
export async function createApiGatewayLambdaRoute(
|
||||
cloud: CloudProvider,
|
||||
apiId: string,
|
||||
@@ -272,6 +326,19 @@ export async function listApiGatewayRoutes(
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function deleteApiGatewayRoute(
|
||||
cloud: CloudProvider,
|
||||
apiId: string,
|
||||
input: DeleteApiGatewayRouteInput,
|
||||
signal?: AbortSignal,
|
||||
): Promise<void> {
|
||||
await apiClient.call<void>(
|
||||
apiEndpointKeys.clouds.resources.deleteApiGatewayRoute,
|
||||
requestOptions(cloud, "apigateway", {signal, params: {stage: input.stage, path: input.path}}),
|
||||
{cloud, id: apiId, resourceId: input.resourceId, method: input.method},
|
||||
);
|
||||
}
|
||||
|
||||
export async function testApiGatewayRoute(
|
||||
cloud: CloudProvider,
|
||||
apiId: string,
|
||||
@@ -286,6 +353,126 @@ export async function testApiGatewayRoute(
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function createS3LambdaTrigger(
|
||||
cloud: CloudProvider,
|
||||
bucketName: string,
|
||||
input: CreateS3LambdaTriggerInput,
|
||||
signal?: AbortSignal,
|
||||
): Promise<S3LambdaTriggerOverview> {
|
||||
const res = await apiClient.call<S3LambdaTriggerOverview, CreateS3LambdaTriggerInput>(
|
||||
apiEndpointKeys.clouds.resources.createS3LambdaTrigger,
|
||||
requestOptions(cloud, "storage", {signal, body: input}),
|
||||
{cloud, id: bucketName},
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function listS3LambdaTriggers(
|
||||
cloud: CloudProvider,
|
||||
bucketName: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<S3LambdaTriggerOverview[]> {
|
||||
const res = await apiClient.call<S3LambdaTriggerOverview[]>(
|
||||
apiEndpointKeys.clouds.resources.listS3LambdaTriggers,
|
||||
requestOptions(cloud, "storage", {signal}),
|
||||
{cloud, id: bucketName},
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function deleteS3LambdaTrigger(
|
||||
cloud: CloudProvider,
|
||||
bucketName: string,
|
||||
triggerId: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<void> {
|
||||
await apiClient.call<void>(
|
||||
apiEndpointKeys.clouds.resources.deleteS3LambdaTrigger,
|
||||
requestOptions(cloud, "storage", {signal}),
|
||||
{cloud, id: bucketName, triggerId},
|
||||
);
|
||||
}
|
||||
|
||||
export async function createEventBridgeLambdaTrigger(
|
||||
cloud: CloudProvider,
|
||||
functionName: string,
|
||||
input: CreateEventBridgeLambdaTriggerInput,
|
||||
signal?: AbortSignal,
|
||||
): Promise<EventBridgeLambdaTriggerOverview> {
|
||||
const res = await apiClient.call<EventBridgeLambdaTriggerOverview, CreateEventBridgeLambdaTriggerInput>(
|
||||
apiEndpointKeys.clouds.resources.createEventBridgeLambdaTrigger,
|
||||
requestOptions(cloud, "serverless", {signal, body: input}),
|
||||
{cloud, id: functionName},
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function listEventBridgeLambdaTriggers(
|
||||
cloud: CloudProvider,
|
||||
functionName: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<EventBridgeLambdaTriggerOverview[]> {
|
||||
const res = await apiClient.call<EventBridgeLambdaTriggerOverview[]>(
|
||||
apiEndpointKeys.clouds.resources.listEventBridgeLambdaTriggers,
|
||||
requestOptions(cloud, "serverless", {signal}),
|
||||
{cloud, id: functionName},
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function deleteEventBridgeLambdaTrigger(
|
||||
cloud: CloudProvider,
|
||||
functionName: string,
|
||||
triggerId: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<void> {
|
||||
await apiClient.call<void>(
|
||||
apiEndpointKeys.clouds.resources.deleteEventBridgeLambdaTrigger,
|
||||
requestOptions(cloud, "serverless", {signal}),
|
||||
{cloud, id: functionName, triggerId},
|
||||
);
|
||||
}
|
||||
|
||||
export async function createSqsLambdaEventSourceMapping(
|
||||
cloud: CloudProvider,
|
||||
functionName: string,
|
||||
input: CreateSqsLambdaEventSourceMappingInput,
|
||||
signal?: AbortSignal,
|
||||
): Promise<SqsLambdaEventSourceMappingOverview> {
|
||||
const res = await apiClient.call<SqsLambdaEventSourceMappingOverview, CreateSqsLambdaEventSourceMappingInput>(
|
||||
apiEndpointKeys.clouds.resources.createSqsLambdaEventSourceMapping,
|
||||
requestOptions(cloud, "serverless", {signal, body: input}),
|
||||
{cloud, id: functionName},
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function listSqsLambdaEventSourceMappings(
|
||||
cloud: CloudProvider,
|
||||
functionName: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<SqsLambdaEventSourceMappingOverview[]> {
|
||||
const res = await apiClient.call<SqsLambdaEventSourceMappingOverview[]>(
|
||||
apiEndpointKeys.clouds.resources.listSqsLambdaEventSourceMappings,
|
||||
requestOptions(cloud, "serverless", {signal}),
|
||||
{cloud, id: functionName},
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function deleteSqsLambdaEventSourceMapping(
|
||||
cloud: CloudProvider,
|
||||
functionName: string,
|
||||
mappingId: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<void> {
|
||||
await apiClient.call<void>(
|
||||
apiEndpointKeys.clouds.resources.deleteSqsLambdaEventSourceMapping,
|
||||
requestOptions(cloud, "serverless", {signal}),
|
||||
{cloud, id: functionName, mappingId},
|
||||
);
|
||||
}
|
||||
|
||||
export type KmsEncryptionAlgorithm =
|
||||
| "SYMMETRIC_DEFAULT"
|
||||
| "RSAES_OAEP_SHA_1"
|
||||
|
||||
Reference in New Issue
Block a user