UNPKG

@broadcom/endevor-bridge-for-git-for-zowe-cli

Version:

Endevor Bridge for Git plug-in for Zowe CLI

134 lines (131 loc) 4.53 kB
'use strict'; /* * Copyright (c) 2026 Broadcom. All Rights Reserved. The term * "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This software and all information contained therein is * confidential and proprietary and shall not be duplicated, * used, disclosed, or disseminated in any way except as * authorized by the applicable license agreement, without the * express written permission of Broadcom. All authorized * reproductions must be marked with this language. * * EXCEPT AS SET FORTH IN THE APPLICABLE LICENSE AGREEMENT, TO * THE EXTENT PERMITTED BY APPLICABLE LAW, BROADCOM PROVIDES THIS * SOFTWARE WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT * LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL BROADCOM * BE LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR * DAMAGE, DIRECT OR INDIRECT, FROM THE USE OF THIS SOFTWARE, * INCLUDING WITHOUT LIMITATION, LOST PROFITS, BUSINESS * INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF BROADCOM IS * EXPRESSLY ADVISED OF SUCH LOSS OR DAMAGE. * */ class EBGConnectionService { /** * Lists connections * @return list of IEndevorConnection * @param apiClient */ static async listConnections(apiClient) { return apiClient.endevorConnectionsApi.get(); } /** * Lists connections * @param apiClient * @param name * @return list of IEndevorConnection */ static async getConnection(apiClient, name) { return apiClient.endevorConnectionsApi.get({ name, }); } /** * Create new connections * @param apiClient * @param payload - base URL, configuration, connection name * @return API response */ static async createConnection(apiClient, payload) { return apiClient.endevorConnectionsApi.create({ endevorConnectionRequest: payload, }); } /** * Deletes a connections * * @param apiClient * @param connection connection ID * @return API response */ static async deleteConnection(apiClient, connection) { return apiClient.endevorConnectionsApi.deleteEndevorConnection({ name: connection, }); } /** * Rename existing connections * @param apiClient * @param payload - old name, new name * @return API response */ static async renameConnection(apiClient, payload) { return apiClient.endevorConnectionsApi.rename({ endevorConnectionUpdateRequest: payload, }); } static async transferConnection(apiClient, context, repo, connection) { return apiClient.repositoryApi.changeConnection({ context, repository: repo, changeConnectionRequest: { newConnection: connection, }, }); } /** * Updates personal mainframe credentials for a connection * * @param apiClient * @param payload request payload * @return API response */ static async updateCredentials(apiClient, payload) { return apiClient.endevorConnectionsApi.login({ updateMainframeCredentialsRequest: payload, }); } static async updateCredentialsCache(apiClient, payload) { return apiClient.endevorConnectionsApi.authenticateCacheUser({ updateMainframeCredentialsRequest: payload, }); } static async refreshCredentialsCache(apiClient, connection) { return apiClient.endevorConnectionsApi.invalidateEndevorCache({ name: connection, }); } static async disableCredentialsCache(apiClient, connection) { return apiClient.endevorConnectionsApi.disableCache({ name: connection, }); } static async getEndevorConnectionClientCertificate(apiClient, connectionName) { return apiClient.endevorConnectionsApi.getClientCertificate({ name: connectionName, }); } static async updateEndevorConnectionClientCertificate(apiClient, payload) { return apiClient.endevorConnectionsApi.updateClientCertificate({ updateCertificateRequest: payload, }); } static async deleteEndevorConnectionClientCertificate(apiClient, connectionName) { return apiClient.endevorConnectionsApi.deleteClientCertificate({ name: connectionName, }); } } exports.EBGConnectionService = EBGConnectionService;