feat: add SQS + EventBridge
This commit is contained in:
@@ -26,7 +26,17 @@ export const apiEndpointKeys = {
|
||||
decrypt: "clouds.services.resources.decrypt",
|
||||
createApiGatewayRoute: "clouds.services.resources.apigateway.route.create",
|
||||
listApiGatewayRoutes: "clouds.services.resources.apigateway.routes.list",
|
||||
testApiGatewayRoute: "clouds.services.resources.apigateway.route.test",
|
||||
deleteApiGatewayRoute: "clouds.services.resources.apigateway.route.delete",
|
||||
testApiGatewayRoute: "clouds.services.resources.apigateway.route.test",
|
||||
createS3LambdaTrigger: "clouds.services.resources.storage.lambda-trigger.create",
|
||||
listS3LambdaTriggers: "clouds.services.resources.storage.lambda-triggers.list",
|
||||
deleteS3LambdaTrigger: "clouds.services.resources.storage.lambda-trigger.delete",
|
||||
createEventBridgeLambdaTrigger: "clouds.services.resources.serverless.eventbridge-trigger.create",
|
||||
listEventBridgeLambdaTriggers: "clouds.services.resources.serverless.eventbridge-triggers.list",
|
||||
deleteEventBridgeLambdaTrigger: "clouds.services.resources.serverless.eventbridge-trigger.delete",
|
||||
createSqsLambdaEventSourceMapping: "clouds.services.resources.serverless.sqs-event-source-mapping.create",
|
||||
listSqsLambdaEventSourceMappings: "clouds.services.resources.serverless.sqs-event-source-mappings.list",
|
||||
deleteSqsLambdaEventSourceMapping: "clouds.services.resources.serverless.sqs-event-source-mapping.delete",
|
||||
},
|
||||
storage: {
|
||||
objects: {
|
||||
@@ -310,6 +320,14 @@ export const endpointRegistry: EndpointRegistry = new Map([
|
||||
telemetry: { service: "apigateway" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.deleteApiGatewayRoute,
|
||||
{
|
||||
path: "/clouds/:cloud/services/apigateway/resources/:id/routes/:resourceId/:method",
|
||||
method: "DELETE",
|
||||
telemetry: { service: "apigateway" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.testApiGatewayRoute,
|
||||
{
|
||||
@@ -318,6 +336,78 @@ export const endpointRegistry: EndpointRegistry = new Map([
|
||||
telemetry: { service: "apigateway" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.createS3LambdaTrigger,
|
||||
{
|
||||
path: "/clouds/:cloud/services/storage/resources/:id/lambda-triggers",
|
||||
method: "POST",
|
||||
telemetry: { service: "storage" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.listS3LambdaTriggers,
|
||||
{
|
||||
path: "/clouds/:cloud/services/storage/resources/:id/lambda-triggers",
|
||||
method: "GET",
|
||||
telemetry: { service: "storage" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.deleteS3LambdaTrigger,
|
||||
{
|
||||
path: "/clouds/:cloud/services/storage/resources/:id/lambda-triggers/:triggerId",
|
||||
method: "DELETE",
|
||||
telemetry: { service: "storage" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.createEventBridgeLambdaTrigger,
|
||||
{
|
||||
path: "/clouds/:cloud/services/serverless/resources/:id/eventbridge-triggers",
|
||||
method: "POST",
|
||||
telemetry: { service: "serverless" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.listEventBridgeLambdaTriggers,
|
||||
{
|
||||
path: "/clouds/:cloud/services/serverless/resources/:id/eventbridge-triggers",
|
||||
method: "GET",
|
||||
telemetry: { service: "serverless" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.deleteEventBridgeLambdaTrigger,
|
||||
{
|
||||
path: "/clouds/:cloud/services/serverless/resources/:id/eventbridge-triggers/:triggerId",
|
||||
method: "DELETE",
|
||||
telemetry: { service: "serverless" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.createSqsLambdaEventSourceMapping,
|
||||
{
|
||||
path: "/clouds/:cloud/services/serverless/resources/:id/sqs-event-source-mappings",
|
||||
method: "POST",
|
||||
telemetry: { service: "serverless" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.listSqsLambdaEventSourceMappings,
|
||||
{
|
||||
path: "/clouds/:cloud/services/serverless/resources/:id/sqs-event-source-mappings",
|
||||
method: "GET",
|
||||
telemetry: { service: "serverless" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.deleteSqsLambdaEventSourceMapping,
|
||||
{
|
||||
path: "/clouds/:cloud/services/serverless/resources/:id/sqs-event-source-mappings/:mappingId",
|
||||
method: "DELETE",
|
||||
telemetry: { service: "serverless" },
|
||||
},
|
||||
],
|
||||
[
|
||||
apiEndpointKeys.clouds.resources.get,
|
||||
{
|
||||
|
||||
@@ -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