@soft-stech/flagger
Version:
105 lines (104 loc) • 3.42 kB
JavaScript
import { z } from "zod";
import { iObjectMetaSchema } from "@soft-stech/apimachinery/apis/meta/v1/ObjectMeta.schema";
/**
* AlertProvider is the Schema for the AlertProvider API.
*/
export const IAlertProviderSchema = z.object({
"apiVersion": z.literal("flagger.app/v1beta1"),
"kind": z.literal("AlertProvider"),
"metadata": iObjectMetaSchema.optional(),
/**
* AlertProviderSpec defines the desired state of a AlertProvider.
*/
"spec": z.object({
/**
* Type of this provider
*/
"type": z.union([z.literal("slack"), z.literal("msteams"), z.literal("discord"), z.literal("rocket"), z.literal("gchat")]).optional(),
/**
* Alert channel for this provider
*/
"channel": z.string().optional(),
/**
* Bot username for this provider
*/
"username": z.string().optional(),
/**
* Hook URL address of this provider
*/
"address": z.string().optional(),
/**
* Http/s proxy of this provider
*/
"proxy": z.string().optional(),
/**
* Kubernetes secret reference containing the provider address
*/
"secretRef": z.object({
/**
* Name of the Kubernetes secret
*/
"name": z.string()
}).optional()
}).and(z.union([z.object({
/**
* Type of this provider
*/
"type": z.union([z.literal("slack"), z.literal("msteams"), z.literal("discord"), z.literal("rocket"), z.literal("gchat")]),
/**
* Alert channel for this provider
*/
"channel": z.string().optional(),
/**
* Bot username for this provider
*/
"username": z.string().optional(),
/**
* Hook URL address of this provider
*/
"address": z.string(),
/**
* Http/s proxy of this provider
*/
"proxy": z.string().optional(),
/**
* Kubernetes secret reference containing the provider address
*/
"secretRef": z.object({
/**
* Name of the Kubernetes secret
*/
"name": z.string()
}).optional()
}), z.object({
/**
* Type of this provider
*/
"type": z.union([z.literal("slack"), z.literal("msteams"), z.literal("discord"), z.literal("rocket"), z.literal("gchat")]),
/**
* Alert channel for this provider
*/
"channel": z.string().optional(),
/**
* Bot username for this provider
*/
"username": z.string().optional(),
/**
* Hook URL address of this provider
*/
"address": z.string().optional(),
/**
* Http/s proxy of this provider
*/
"proxy": z.string().optional(),
/**
* Kubernetes secret reference containing the provider address
*/
"secretRef": z.object({
/**
* Name of the Kubernetes secret
*/
"name": z.string()
})
})])).optional()
});