/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 81bb2d90f8df */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomSensitiveRuleType, CustomSensitiveRuleType$inboundSchema, CustomSensitiveRuleType$outboundSchema, } from "./customsensitiveruletype.js"; /** * Likelihood threshold for BUILT_IN infotypes (e.g., LIKELY, VERY_LIKELY). Only applicable for BUILT_IN type. */ export const CustomSensitiveRuleLikelihoodThreshold = { Likely: "LIKELY", VeryLikely: "VERY_LIKELY", Possible: "POSSIBLE", Unlikely: "UNLIKELY", VeryUnlikely: "VERY_UNLIKELY", } as const; /** * Likelihood threshold for BUILT_IN infotypes (e.g., LIKELY, VERY_LIKELY). Only applicable for BUILT_IN type. */ export type CustomSensitiveRuleLikelihoodThreshold = OpenEnum< typeof CustomSensitiveRuleLikelihoodThreshold >; export type CustomSensitiveRule = { /** * Identifier for the custom sensitive expression. */ id?: string | undefined; /** * The value of the custom sensitive rule. For REGEX type, this is the regex pattern; for TERM type, it is the term to match; and for INFO_TYPE type, it refers to predefined categories of sensitive content. See https://cloud.google.com/dlp/docs/infotypes-reference for available options. */ value?: string | undefined; /** * Type of the custom sensitive rule. */ type?: CustomSensitiveRuleType | undefined; /** * Likelihood threshold for BUILT_IN infotypes (e.g., LIKELY, VERY_LIKELY). Only applicable for BUILT_IN type. */ likelihoodThreshold?: CustomSensitiveRuleLikelihoodThreshold | undefined; }; /** @internal */ export const CustomSensitiveRuleLikelihoodThreshold$inboundSchema: z.ZodType< CustomSensitiveRuleLikelihoodThreshold, z.ZodTypeDef, unknown > = openEnums.inboundSchema(CustomSensitiveRuleLikelihoodThreshold); /** @internal */ export const CustomSensitiveRuleLikelihoodThreshold$outboundSchema: z.ZodType< string, z.ZodTypeDef, CustomSensitiveRuleLikelihoodThreshold > = openEnums.outboundSchema(CustomSensitiveRuleLikelihoodThreshold); /** @internal */ export const CustomSensitiveRule$inboundSchema: z.ZodType< CustomSensitiveRule, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), value: z.string().optional(), type: CustomSensitiveRuleType$inboundSchema.optional(), likelihoodThreshold: CustomSensitiveRuleLikelihoodThreshold$inboundSchema .optional(), }); /** @internal */ export type CustomSensitiveRule$Outbound = { id?: string | undefined; value?: string | undefined; type?: string | undefined; likelihoodThreshold?: string | undefined; }; /** @internal */ export const CustomSensitiveRule$outboundSchema: z.ZodType< CustomSensitiveRule$Outbound, z.ZodTypeDef, CustomSensitiveRule > = z.object({ id: z.string().optional(), value: z.string().optional(), type: CustomSensitiveRuleType$outboundSchema.optional(), likelihoodThreshold: CustomSensitiveRuleLikelihoodThreshold$outboundSchema .optional(), }); export function customSensitiveRuleToJSON( customSensitiveRule: CustomSensitiveRule, ): string { return JSON.stringify( CustomSensitiveRule$outboundSchema.parse(customSensitiveRule), ); } export function customSensitiveRuleFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomSensitiveRule$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomSensitiveRule' from JSON`, ); }