@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>
132 lines (120 loc) • 3.66 kB
text/typescript
/*
* 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 { Result as SafeParseResult } from "../types/fp.js";
import * as types from "../types/primitives.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
export type GetSecurityFirewallEventsRequest = {
projectId: string;
startTimestamp?: number | undefined;
endTimestamp?: number | undefined;
hosts?: string | undefined;
/**
* The Team identifier to perform the request on behalf of.
*/
teamId?: string | undefined;
/**
* The Team slug to perform the request on behalf of.
*/
slug?: string | undefined;
};
export type GetSecurityFirewallEventsActions = {
ruleName: string | null;
startTime: string;
endTime: string;
isActive: boolean;
actionType: string;
action: string;
ruleId: string | null;
host: string;
publicIp: string;
count: number;
};
export type GetSecurityFirewallEventsResponseBody = {
actions: Array<GetSecurityFirewallEventsActions>;
};
/** @internal */
export type GetSecurityFirewallEventsRequest$Outbound = {
projectId: string;
startTimestamp?: number | undefined;
endTimestamp?: number | undefined;
hosts?: string | undefined;
teamId?: string | undefined;
slug?: string | undefined;
};
/** @internal */
export const GetSecurityFirewallEventsRequest$outboundSchema: z.ZodType<
GetSecurityFirewallEventsRequest$Outbound,
z.ZodTypeDef,
GetSecurityFirewallEventsRequest
> = z.object({
projectId: z.string(),
startTimestamp: z.number().optional(),
endTimestamp: z.number().optional(),
hosts: z.string().optional(),
teamId: z.string().optional(),
slug: z.string().optional(),
});
export function getSecurityFirewallEventsRequestToJSON(
getSecurityFirewallEventsRequest: GetSecurityFirewallEventsRequest,
): string {
return JSON.stringify(
GetSecurityFirewallEventsRequest$outboundSchema.parse(
getSecurityFirewallEventsRequest,
),
);
}
/** @internal */
export const GetSecurityFirewallEventsActions$inboundSchema: z.ZodType<
GetSecurityFirewallEventsActions,
z.ZodTypeDef,
unknown
> = z.object({
ruleName: types.nullable(types.string()),
startTime: types.string(),
endTime: types.string(),
isActive: types.boolean(),
action_type: types.string(),
action: types.string(),
ruleId: types.nullable(types.string()),
host: types.string(),
public_ip: types.string(),
count: types.number(),
}).transform((v) => {
return remap$(v, {
"action_type": "actionType",
"public_ip": "publicIp",
});
});
export function getSecurityFirewallEventsActionsFromJSON(
jsonString: string,
): SafeParseResult<GetSecurityFirewallEventsActions, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetSecurityFirewallEventsActions$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetSecurityFirewallEventsActions' from JSON`,
);
}
/** @internal */
export const GetSecurityFirewallEventsResponseBody$inboundSchema: z.ZodType<
GetSecurityFirewallEventsResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
actions: z.array(
z.lazy(() => GetSecurityFirewallEventsActions$inboundSchema),
),
});
export function getSecurityFirewallEventsResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetSecurityFirewallEventsResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) =>
GetSecurityFirewallEventsResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetSecurityFirewallEventsResponseBody' from JSON`,
);
}