pesco-karavan-core
Version:
Apache Camel Karavan Core
56 lines (55 loc) • 2.22 kB
JavaScript
;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Kamelet = void 0;
var KameletModels_1 = require("./KameletModels");
var Kamelet = /** @class */ (function () {
function Kamelet(init) {
this.apiVersion = 'camel.apache.org/v1alpha1';
this.kind = 'Kamelet';
this.metadata = new KameletModels_1.KameletMetadata();
this.spec = new KameletModels_1.KameletSpec();
Object.assign(this, init);
}
Kamelet.createKamelet = function (title, type, description, icon) {
var spec = new KameletModels_1.KameletSpec({
definition: new KameletModels_1.Definition({
title: title,
description: description
})
});
if (type === 'action' || type === 'sink') {
spec.template = {
from: {
steps: [],
uri: 'kamelet:source'
}
};
}
return new Kamelet({
metadata: {
name: "",
annotations: icon ? new KameletModels_1.Annotations({ 'camel.apache.org/kamelet.icon': icon }) : new KameletModels_1.Annotations(),
labels: new KameletModels_1.Labels({ 'camel.apache.org/kamelet.type': type || 'source' })
},
spec: spec
});
};
return Kamelet;
}());
exports.Kamelet = Kamelet;