@soft-stech/keda
Version:
KEDA(Kubernetes Event-driven Autoscaling) models
174 lines (173 loc) • 5.78 kB
JavaScript
import { addSchema } from "@soft-stech/apimachinery/_schemas/IoK8sApimachineryPkgApisMetaV1ObjectMeta";
import { Model, setSchema, createTypeMetaGuard } from "@soft-stech/base";
import { register } from "@soft-stech/validate";
const schemaId = "eventing.keda.sh.v1alpha1.CloudEventSource";
const schema = {
"type": "object",
"properties": {
"apiVersion": {
"type": "string",
"enum": [
"eventing.keda.sh/v1alpha1"
]
},
"kind": {
"type": "string",
"enum": [
"CloudEventSource"
]
},
"metadata": {
"oneOf": [
{
"$ref": "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta#"
},
{
"type": "null"
}
]
},
"spec": {
"properties": {
"authenticationRef": {
"properties": {
"kind": {
"type": "string",
"nullable": true
},
"name": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object",
"nullable": true
},
"clusterName": {
"type": "string",
"nullable": true
},
"destination": {
"properties": {
"azureEventGridTopic": {
"properties": {
"endpoint": {
"type": "string"
}
},
"required": [
"endpoint"
],
"type": "object",
"nullable": true
},
"http": {
"properties": {
"uri": {
"type": "string"
}
},
"required": [
"uri"
],
"type": "object",
"nullable": true
}
},
"type": "object"
},
"eventSubscription": {
"properties": {
"excludedEventTypes": {
"items": {
"enum": [
"keda.scaledobject.ready.v1",
"keda.scaledobject.failed.v1"
],
"type": "string"
},
"type": "array",
"nullable": true
},
"includedEventTypes": {
"items": {
"enum": [
"keda.scaledobject.ready.v1",
"keda.scaledobject.failed.v1"
],
"type": "string"
},
"type": "array",
"nullable": true
}
},
"type": "object",
"nullable": true
}
},
"required": [
"destination"
],
"type": "object"
},
"status": {
"properties": {
"conditions": {
"items": {
"properties": {
"message": {
"type": "string",
"nullable": true
},
"reason": {
"type": "string",
"nullable": true
},
"status": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"status",
"type"
],
"type": "object"
},
"type": "array",
"nullable": true
}
},
"type": "object",
"nullable": true
}
},
"required": [
"spec",
"apiVersion",
"kind"
]
};
/**
* CloudEventSource defines how a KEDA event will be sent to event sink
*/
export class CloudEventSource extends Model {
constructor(data) {
super({
apiVersion: CloudEventSource.apiVersion,
kind: CloudEventSource.kind,
...data
});
}
}
CloudEventSource.apiVersion = "eventing.keda.sh/v1alpha1";
CloudEventSource.kind = "CloudEventSource";
CloudEventSource.is = createTypeMetaGuard(CloudEventSource);
setSchema(CloudEventSource, schemaId, () => {
addSchema();
register(schemaId, schema);
});