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
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-vault-node': minor
---
Initial version of the `plugin-vault-node`` package. It contains the extension point definitions
for the vault backend, as well as some types that will be deprecated in the backend plugin.
+1
View File
@@ -0,0 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
+3
View File
@@ -0,0 +1,3 @@
# @backstage/plugin-vault-node
Houses types and utilities for building the vault modules
+38
View File
@@ -0,0 +1,38 @@
## API Report File for "@backstage/plugin-vault-node"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { ExtensionPoint } from '@backstage/backend-plugin-api';
// @public
export interface VaultApi {
getFrontendSecretsUrl(): string;
listSecrets(
secretPath: string,
options?: {
secretEngine?: string;
},
): Promise<VaultSecret[]>;
renewToken?(): Promise<void>;
}
// @public
export interface VaultExtensionPoint {
// (undocumented)
setClient(vaultClient: VaultApi): void;
}
// @public
export const vaultExtensionPoint: ExtensionPoint<VaultExtensionPoint>;
// @public
export type VaultSecret = {
name: string;
path: string;
showUrl: string;
editUrl: string;
};
// (No @packageDocumentation comment for this package)
```
+10
View File
@@ -0,0 +1,10 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: backstage-plugin-vault-node
title: '@backstage/plugin-vault-node'
description: Node.js library for the vault plugin
spec:
lifecycle: experimental
type: backstage-node-library
owner: maintainers
+33
View File
@@ -0,0 +1,33 @@
{
"name": "@backstage/plugin-vault-node",
"description": "Node.js library for the vault plugin",
"version": "0.0.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "node-library"
},
"scripts": {
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"clean": "backstage-cli package clean",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-plugin-api": "workspace:^"
},
"devDependencies": {
"@backstage/cli": "workspace:^"
},
"files": [
"dist"
]
}
+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 {};
+10
View File
@@ -9909,6 +9909,7 @@ __metadata:
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
"@backstage/errors": "workspace:^"
"@backstage/plugin-vault-node": "workspace:^"
"@types/compression": ^1.7.2
"@types/express": "*"
"@types/supertest": ^2.0.8
@@ -9926,6 +9927,15 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/plugin-vault-node@workspace:^, @backstage/plugin-vault-node@workspace:plugins/vault-node":
version: 0.0.0-use.local
resolution: "@backstage/plugin-vault-node@workspace:plugins/vault-node"
dependencies:
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/cli": "workspace:^"
languageName: unknown
linkType: soft
"@backstage/plugin-vault@workspace:plugins/vault":
version: 0.0.0-use.local
resolution: "@backstage/plugin-vault@workspace:plugins/vault"