Create vault-node package. Initial step for fully supporting the new backend system

Signed-off-by: ivgo <ivgo@spreadgroup.com>
This commit is contained in:
ivgo
2023-10-02 13:55:21 +02:00
parent ed49feac94
commit 7a41bcf2af
12 changed files with 241 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
/*
* Copyright 2023 The Backstage Authors
*
* 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.
*/
export * from './types';
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright 2023 The Backstage Authors
*
* 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 containing the secret name and some links
* @public
*/
export type VaultSecret = {
name: string;
path: string;
showUrl: string;
editUrl: string;
};
/**
* Interface for the Vault API
* @public
*/
export interface VaultApi {
/**
* Returns the URL to access the Vault UI with the defined config.
*/
getFrontendSecretsUrl(): string;
/**
* Returns a list of secrets used to show in a table.
* @param secretPath - The path where the secrets are stored in Vault
* @param options - Additional options to be passed to the Vault API, allows to override vault default settings in app config file
*/
listSecrets(
secretPath: string,
options?: {
secretEngine?: string;
},
): Promise<VaultSecret[]>;
/**
* Optional, to renew the token used to list the secrets. Throws an
* error if the token renewal went wrong.
*/
renewToken?(): Promise<void>;
}
+36
View File
@@ -0,0 +1,36 @@
/*
* Copyright 2023 The Backstage Authors
*
* 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.
*/
import { createExtensionPoint } from '@backstage/backend-plugin-api';
import { VaultApi } from './api';
/**
* Extension point for vault.
*
* @public
*/
export interface VaultExtensionPoint {
setClient(vaultClient: VaultApi): void;
}
/**
* Extension point for vault.
*
* @public
*/
export const vaultExtensionPoint = createExtensionPoint<VaultExtensionPoint>({
id: 'vault.configuration',
});
+17
View File
@@ -0,0 +1,17 @@
/*
* Copyright 2023 The Backstage Authors
*
* 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.
*/
export { type VaultExtensionPoint, vaultExtensionPoint } from './extensions';
export type { VaultApi, VaultSecret } from './api';
+16
View File
@@ -0,0 +1,16 @@
/*
* Copyright 2023 The Backstage Authors
*
* 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.
*/
export {};