@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
154 lines • 6.05 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
import * as types from "../types/primitives.js";
/**
* The delivery log format
*/
export const CreateLogDrainDeliveryFormat = {
Json: "json",
Ndjson: "ndjson",
};
export const CreateLogDrainSources = {
Static: "static",
Lambda: "lambda",
Build: "build",
Edge: "edge",
External: "external",
Firewall: "firewall",
};
export const CreateLogDrainEnvironments = {
Preview: "preview",
Production: "production",
};
/**
* The delivery log format
*/
export const CreateLogDrainLogDrainsDeliveryFormat = {
Json: "json",
Ndjson: "ndjson",
Protobuf: "protobuf",
};
/**
* The sources from which logs are currently being delivered to this log drain.
*/
export const CreateLogDrainLogDrainsSources = {
Build: "build",
Edge: "edge",
External: "external",
Firewall: "firewall",
Lambda: "lambda",
Redirect: "redirect",
Static: "static",
};
/**
* Whether the log drain was created by an integration or by a user
*/
export const CreateLogDrainCreatedFrom = {
Integration: "integration",
SelfServed: "self-served",
};
/**
* The environment of log drain
*/
export const CreateLogDrainLogDrainsEnvironments = {
Preview: "preview",
Production: "production",
};
/** @internal */
export const CreateLogDrainDeliveryFormat$outboundSchema = z.nativeEnum(CreateLogDrainDeliveryFormat);
/** @internal */
export const CreateLogDrainSources$outboundSchema = z.nativeEnum(CreateLogDrainSources);
/** @internal */
export const CreateLogDrainEnvironments$outboundSchema = z.nativeEnum(CreateLogDrainEnvironments);
/** @internal */
export const CreateLogDrainRequestBody$outboundSchema = z.object({
name: z.string(),
projectIds: z.array(z.string()).optional(),
secret: z.string().optional(),
deliveryFormat: CreateLogDrainDeliveryFormat$outboundSchema.optional(),
url: z.string(),
sources: z.array(CreateLogDrainSources$outboundSchema).optional(),
headers: z.record(z.string()).optional(),
environments: z.array(CreateLogDrainEnvironments$outboundSchema).optional(),
});
export function createLogDrainRequestBodyToJSON(createLogDrainRequestBody) {
return JSON.stringify(CreateLogDrainRequestBody$outboundSchema.parse(createLogDrainRequestBody));
}
/** @internal */
export const CreateLogDrainRequest$outboundSchema = z.object({
teamId: z.string().optional(),
slug: z.string().optional(),
requestBody: z.lazy(() => CreateLogDrainRequestBody$outboundSchema),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function createLogDrainRequestToJSON(createLogDrainRequest) {
return JSON.stringify(CreateLogDrainRequest$outboundSchema.parse(createLogDrainRequest));
}
/** @internal */
export const CreateLogDrainLogDrainsDeliveryFormat$inboundSchema = z.nativeEnum(CreateLogDrainLogDrainsDeliveryFormat);
/** @internal */
export const CreateLogDrainLogDrainsSources$inboundSchema = z.nativeEnum(CreateLogDrainLogDrainsSources);
/** @internal */
export const CreateLogDrainCreatedFrom$inboundSchema = z.nativeEnum(CreateLogDrainCreatedFrom);
/** @internal */
export const CreateLogDrainLogDrainsEnvironments$inboundSchema = z.nativeEnum(CreateLogDrainLogDrainsEnvironments);
/** @internal */
export const CreateLogDrainSource2$inboundSchema = z.object({
kind: types.literal("integration"),
resourceId: types.optional(types.string()),
externalResourceId: types.optional(types.string()),
integrationId: types.string(),
integrationConfigurationId: types.string(),
});
export function createLogDrainSource2FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateLogDrainSource2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateLogDrainSource2' from JSON`);
}
/** @internal */
export const CreateLogDrainSource1$inboundSchema = z.object({
kind: types.literal("self-served"),
});
export function createLogDrainSource1FromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateLogDrainSource1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateLogDrainSource1' from JSON`);
}
/** @internal */
export const CreateLogDrainSource$inboundSchema = z.union([
z.lazy(() => CreateLogDrainSource1$inboundSchema),
z.lazy(() => CreateLogDrainSource2$inboundSchema),
]);
export function createLogDrainSourceFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateLogDrainSource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateLogDrainSource' from JSON`);
}
/** @internal */
export const CreateLogDrainResponseBody$inboundSchema = z.object({
clientId: types.optional(types.string()),
configurationId: types.optional(types.string()),
createdAt: types.number(),
id: types.string(),
deliveryFormat: types.optional(CreateLogDrainLogDrainsDeliveryFormat$inboundSchema),
name: types.string(),
ownerId: types.string(),
projectId: z.nullable(types.string()).optional(),
projectIds: types.optional(z.array(types.string())),
url: types.string(),
sources: types.optional(z.array(CreateLogDrainLogDrainsSources$inboundSchema)),
createdFrom: types.optional(CreateLogDrainCreatedFrom$inboundSchema),
headers: types.optional(z.record(types.string())),
environments: types.optional(z.array(CreateLogDrainLogDrainsEnvironments$inboundSchema)),
branch: types.optional(types.string()),
samplingRate: types.optional(types.number()),
source: z.union([
z.lazy(() => CreateLogDrainSource1$inboundSchema),
z.lazy(() => CreateLogDrainSource2$inboundSchema),
]),
});
export function createLogDrainResponseBodyFromJSON(jsonString) {
return safeParse(jsonString, (x) => CreateLogDrainResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateLogDrainResponseBody' from JSON`);
}
//# sourceMappingURL=createlogdrainop.js.map