Adekabang 33ed173dec feat: align API endpoints with official specifications for bucket and key management
- Updated HTTP methods for bucket and key operations to align with the official Garage Admin API v2 specifications, changing DELETE methods to POST where necessary.
- Modified frontend hooks and documentation to reflect these changes, ensuring consistency across the application.
- Completed tasks for verifying and aligning delete operations and reviewing other HTTP methods.
2025-07-31 18:10:39 -04:00

25 lines
739 B
TypeScript

import { z } from "zod";
export const createKeySchema = z
.object({
name: z
.string()
.min(1, "Key Name is required")
.regex(/^[a-zA-Z0-9_-]+$/, "Key Name invalid"),
isImport: z.boolean().default(false),
accessKeyId: z.string().optional(),
secretAccessKey: z.string().optional(),
})
.refine(
(v) => !v.isImport || (v.accessKeyId != null && v.accessKeyId.length > 0),
{ message: "Access key ID is required", path: ["accessKeyId"] }
)
.refine(
(v) =>
!v.isImport ||
(v.secretAccessKey != null && v.secretAccessKey.length > 0),
{ message: "Secret access key is required", path: ["secretAccessKey"] }
);
export type CreateKeySchema = z.infer<typeof createKeySchema>;