feat: CORS enable button...ish still now understanding this

This commit is contained in:
Zakaria
2026-09-27 14:46:04 -04:00
parent 8470b8d17a
commit b474e823ce
17 changed files with 943 additions and 31 deletions
@@ -35,6 +35,7 @@ import type {
SqlQueryResult,
SqlTable,
StorageObjectList,
S3BucketWebsiteConfiguration,
} from "@/types/resource";
import type { ServiceSchema } from "@/types/schema";
import { getAccountId } from "@/lib/accountStore";
@@ -267,6 +268,7 @@ export interface ApiGatewayRouteOverview {
path: string;
method: string;
functionName: string | null;
integrationType: string | null;
}
export interface ApiGatewayRoutesResult {
@@ -281,6 +283,19 @@ export interface DeleteApiGatewayRouteInput {
stage: string;
}
export interface EnableApiGatewayCorsInput {
resourceId: string;
stage: string;
origin: string;
headers: string;
methods: string[];
}
export interface ApiGatewayCorsResult {
configuredMethods: string[];
proxyMethods: string[];
}
export interface CreateS3LambdaTriggerInput {
functionName: string;
events: string[];
@@ -402,6 +417,20 @@ export async function deleteApiGatewayRoute(
);
}
export async function enableApiGatewayCors(
cloud: CloudProvider,
apiId: string,
input: EnableApiGatewayCorsInput,
signal?: AbortSignal,
): Promise<ApiGatewayCorsResult> {
const res = await apiClient.call<ApiGatewayCorsResult, EnableApiGatewayCorsInput>(
apiEndpointKeys.clouds.resources.enableApiGatewayCors,
requestOptions(cloud, "apigateway", {signal, body: input}),
{cloud, id: apiId},
);
return res.data;
}
export async function testApiGatewayRoute(
cloud: CloudProvider,
apiId: string,
@@ -456,6 +485,44 @@ export async function deleteS3LambdaTrigger(
);
}
export async function getS3BucketWebsite(
cloud: CloudProvider,
bucketName: string,
signal?: AbortSignal,
): Promise<S3BucketWebsiteConfiguration | null> {
const res = await apiClient.call<S3BucketWebsiteConfiguration | null>(
apiEndpointKeys.clouds.resources.getS3BucketWebsite,
requestOptions(cloud, "storage", {signal}),
{cloud, id: bucketName},
);
return res.data;
}
export async function putS3BucketWebsite(
cloud: CloudProvider,
bucketName: string,
configuration: S3BucketWebsiteConfiguration,
signal?: AbortSignal,
): Promise<void> {
await apiClient.call<void, S3BucketWebsiteConfiguration>(
apiEndpointKeys.clouds.resources.putS3BucketWebsite,
requestOptions(cloud, "storage", {signal, body: configuration}),
{cloud, id: bucketName},
);
}
export async function deleteS3BucketWebsite(
cloud: CloudProvider,
bucketName: string,
signal?: AbortSignal,
): Promise<void> {
await apiClient.call<void>(
apiEndpointKeys.clouds.resources.deleteS3BucketWebsite,
requestOptions(cloud, "storage", {signal}),
{cloud, id: bucketName},
);
}
export async function createSnsSubscription(
cloud: CloudProvider,
topicArn: string,