UNPKG

@atomist/sdm

Version:

Atomist Software Delivery Machine SDK

88 lines 3.08 kB
"use strict"; /* * Copyright © 2020 Atomist, Inc. * * Licensed 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.makeNoOpApiClients = exports.makeApiClients = void 0; const k8s = require("@kubernetes/client-node"); /** * Create the KubernetesClients structure. */ function makeApiClients(kc) { const core = kc.makeApiClient(k8s.CoreV1Api); const apps = kc.makeApiClient(k8s.AppsV1Api); const rbac = kc.makeApiClient(k8s.RbacAuthorizationV1Api); const net = kc.makeApiClient(k8s.NetworkingV1beta1Api); return { core, apps, net, rbac }; } exports.makeApiClients = makeApiClients; /** * Provide no-op client when only want changes persisted to the GitOps * sync repo. */ function makeNoOpApiClients() { const noop = async () => { }; const core = { createNamespace: noop, deleteNamespace: noop, patchNamespace: noop, readNamespace: noop, createNamespacedSecret: noop, deleteNamespacedSecret: noop, patchNamespacedSecret: noop, readNamespacedSecret: noop, createNamespacedService: noop, deleteNamespacedService: noop, patchNamespacedService: noop, readNamespacedService: noop, createNamespacedServiceAccount: noop, deleteNamespacedServiceAccount: noop, patchNamespacedServiceAccount: noop, readNamespacedServiceAccount: noop, }; const apps = { createNamespacedDeployment: noop, deleteNamespacedDeployment: noop, patchNamespacedDeployment: noop, readNamespacedDeployment: noop, }; const net = { createNamespacedIngress: noop, deleteNamespacedIngress: noop, patchNamespacedIngress: noop, readNamespacedIngress: noop, }; const rbac = { createClusterRole: noop, deleteClusterRole: noop, patchClusterRole: noop, readClusterRole: noop, createClusterRoleBinding: noop, deleteClusterRoleBinding: noop, patchClusterRoleBinding: noop, readClusterRoleBinding: noop, createNamespacedRole: noop, deleteNamespacedRole: noop, patchNamespacedRole: noop, readNamespacedRole: noop, createNamespacedRoleBinding: noop, deleteNamespacedRoleBinding: noop, patchNamespacedRoleBinding: noop, readNamespacedRoleBinding: noop, }; return { core, apps, net, rbac }; } exports.makeNoOpApiClients = makeNoOpApiClients; //# sourceMappingURL=clients.js.map