UNPKG

@soft-stech/flagger

Version:
113 lines (112 loc) 3.48 kB
import { addSchema } from "@soft-stech/apimachinery/_schemas/IoK8sApimachineryPkgApisMetaV1ObjectMeta"; import { Model, setSchema, createTypeMetaGuard } from "@soft-stech/base"; import { register } from "@soft-stech/validate"; const schemaId = "flagger.app.v1beta1.MetricTemplate"; const schema = { "type": "object", "properties": { "apiVersion": { "type": "string", "enum": [ "flagger.app/v1beta1" ] }, "kind": { "type": "string", "enum": [ "MetricTemplate" ] }, "metadata": { "oneOf": [ { "$ref": "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta#" }, { "type": "null" } ] }, "spec": { "type": "object", "required": [ "provider", "query" ], "properties": { "provider": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "prometheus", "influxdb", "datadog", "stackdriver", "cloudwatch", "newrelic", "graphite", "dynatrace" ] }, "address": { "type": "string", "nullable": true }, "secretRef": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string" } }, "nullable": true }, "region": { "type": "string", "nullable": true }, "insecureSkipVerify": { "type": "boolean", "nullable": true } } }, "query": { "type": "string" } }, "nullable": true } }, "required": [ "apiVersion", "kind" ] }; /** * MetricTemplate is the Schema for the MetricTemplates API. */ export class MetricTemplate extends Model { constructor(data) { super({ apiVersion: MetricTemplate.apiVersion, kind: MetricTemplate.kind, ...data }); } } MetricTemplate.apiVersion = "flagger.app/v1beta1"; MetricTemplate.kind = "MetricTemplate"; MetricTemplate.is = createTypeMetaGuard(MetricTemplate); setSchema(MetricTemplate, schemaId, () => { addSchema(); register(schemaId, schema); });