import {z} from 'zod' export type DeleteApiApiV1SecretSyncsGcpSecretManagerSyncIdArgs = {removeSecrets?: ('true' | 'false') | undefined, syncId: string}; export type DeleteApiApiV1SecretSyncsGcpSecretManagerSyncIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; export const deleteApiApiV1SecretSyncsGcpSecretManagerSyncIdResponse = z.object({secretSync: z.object({id: z.string(), name: z.string(), description: z.string().nullable().optional(), isAutoSyncEnabled: z.boolean().optional(), version: z.number().optional(), projectId: z.string(), folderId: z.string().nullable().optional(), connectionId: z.string(), createdAt: z.string(), updatedAt: z.string(), syncStatus: z.string().nullable().optional(), lastSyncJobId: z.string().nullable().optional(), lastSyncMessage: z.string().nullable().optional(), lastSyncedAt: z.string().nullable().optional(), importStatus: z.string().nullable().optional(), lastImportJobId: z.string().nullable().optional(), lastImportMessage: z.string().nullable().optional(), lastImportedAt: z.string().nullable().optional(), removeStatus: z.string().nullable().optional(), lastRemoveJobId: z.string().nullable().optional(), lastRemoveMessage: z.string().nullable().optional(), lastRemovedAt: z.string().nullable().optional(), lastSyncResult: z.string().nullable().optional(), syncOptions: z.object({initialSyncBehavior: z.enum(["overwrite-destination", "import-prioritize-source", "import-prioritize-destination"]), keySchema: z.string().max(255).optional(), disableSecretDeletion: z.boolean().optional(), includeAllSubFolders: z.boolean().optional()}), connection: z.object({app: z.literal("gcp"), name: z.string(), id: z.string()}), environment: z.object({slug: z.string(), name: z.string(), id: z.string()}).nullable(), folder: z.object({id: z.string(), path: z.string()}).nullable(), destination: z.literal("gcp-secret-manager"), destinationConfig: z.union([z.object({scope: z.literal("global"), projectId: z.string().min(1), locationId: z.enum(["asia-southeast3", "asia-south2", "asia-east2", "asia-southeast2", "australia-southeast2", "asia-south1", "asia-northeast2", "asia-northeast3", "asia-southeast1", "australia-southeast1", "asia-east1", "asia-northeast1", "europe-west1", "europe-west10", "europe-north1", "europe-north2", "europe-west3", "europe-west2", "europe-southwest1", "europe-west8", "europe-west4", "europe-west12", "europe-west9", "europe-central2", "europe-west6", "us-central1", "us-west4", "us-west2", "northamerica-south1", "northamerica-northeast1", "us-east4", "us-central2", "us-west1", "us-west3", "us-east1", "northamerica-northeast2", "us-east5", "us-south1", "us-west8", "southamerica-east1", "southamerica-west1", "me-central2", "me-central1", "me-west1", "africa-south1"]).optional(), userReplicaLocationIds: z.array(z.enum(["asia-southeast3", "asia-south2", "asia-east2", "asia-southeast2", "australia-southeast2", "asia-south1", "asia-northeast2", "asia-northeast3", "asia-southeast1", "australia-southeast1", "asia-east1", "asia-northeast1", "europe-west1", "europe-west10", "europe-north1", "europe-north2", "europe-west3", "europe-west2", "europe-southwest1", "europe-west8", "europe-west4", "europe-west12", "europe-west9", "europe-central2", "europe-west6", "us-central1", "us-west4", "us-west2", "northamerica-south1", "northamerica-northeast1", "us-east4", "us-central2", "us-west1", "us-west3", "us-east1", "northamerica-northeast2", "us-east5", "us-south1", "us-west8", "southamerica-east1", "southamerica-west1", "me-central2", "me-central1", "me-west1", "africa-south1"])).optional()}), z.object({scope: z.literal("region"), projectId: z.string().min(1), locationId: z.enum(["asia-southeast3", "asia-south2", "asia-east2", "asia-southeast2", "australia-southeast2", "asia-south1", "asia-northeast2", "asia-northeast3", "asia-southeast1", "australia-southeast1", "asia-east1", "asia-northeast1", "europe-west1", "europe-west10", "europe-north1", "europe-north2", "europe-west3", "europe-west2", "europe-southwest1", "europe-west8", "europe-west4", "europe-west12", "europe-west9", "europe-central2", "europe-west6", "us-central1", "us-west4", "us-west2", "northamerica-south1", "northamerica-northeast1", "us-east4", "us-central2", "us-west1", "us-west3", "us-east1", "northamerica-northeast2", "us-east5", "us-south1", "us-west8", "southamerica-east1", "southamerica-west1", "me-central2", "me-central1", "me-west1", "africa-south1"])})])})}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Delete the specified GCP Secret Manager Sync. * * DELETE /api/v1/secret-syncs/gcp-secret-manager/{syncId} */ export const deleteApiApiV1SecretSyncsGcpSecretManagerSyncId = async (args: DeleteApiApiV1SecretSyncsGcpSecretManagerSyncIdArgs, options?: DeleteApiApiV1SecretSyncsGcpSecretManagerSyncIdOptions) => { const {baseUrl = "https://us.infisical.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.removeSecrets != null) query.append("removeSecrets", String(args.removeSecrets)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/secret-syncs/gcp-secret-manager/${encodeURIComponent(String(args.syncId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(deleteApiApiV1SecretSyncsGcpSecretManagerSyncIdResponse, await res.json()) };