@soft-stech/fleet
Version:
80 lines (79 loc) • 2.27 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 = "fleet.cattle.io.v1alpha1.ClusterRegistrationToken";
const schema = {
"type": "object",
"properties": {
"apiVersion": {
"type": "string",
"enum": [
"fleet.cattle.io/v1alpha1"
]
},
"kind": {
"type": "string",
"enum": [
"ClusterRegistrationToken"
]
},
"metadata": {
"oneOf": [
{
"$ref": "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta#"
},
{
"type": "null"
}
]
},
"spec": {
"properties": {
"ttl": {
"nullable": true,
"type": "string"
}
},
"type": "object",
"nullable": true
},
"status": {
"properties": {
"expires": {
"format": "date-time",
"type": "string",
"nullable": true
},
"secretName": {
"nullable": true,
"type": "string"
}
},
"type": "object",
"nullable": true
}
},
"required": [
"apiVersion",
"kind"
]
};
/**
* ClusterRegistrationToken is used by agents to register a new cluster.
*/
export class ClusterRegistrationToken extends Model {
constructor(data) {
super({
apiVersion: ClusterRegistrationToken.apiVersion,
kind: ClusterRegistrationToken.kind,
...data
});
}
}
ClusterRegistrationToken.apiVersion = "fleet.cattle.io/v1alpha1";
ClusterRegistrationToken.kind = "ClusterRegistrationToken";
ClusterRegistrationToken.is = createTypeMetaGuard(ClusterRegistrationToken);
setSchema(ClusterRegistrationToken, schemaId, () => {
addSchema();
register(schemaId, schema);
});