mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Begin foundation for secrets v3
This commit is contained in:
5
backend/src/controllers/v3/index.ts
Normal file
5
backend/src/controllers/v3/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import * as secretsController from './secretsController';
|
||||
|
||||
export {
|
||||
secretsController
|
||||
}
|
||||
66
backend/src/controllers/v3/secretsController.ts
Normal file
66
backend/src/controllers/v3/secretsController.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import { Request, Response } from 'express';
|
||||
import {
|
||||
Secret
|
||||
} from '../../models';
|
||||
|
||||
/**
|
||||
* Get secrets for workspace with id [workspaceId] and environment
|
||||
* [environment]
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
export const getSecrets = async (req: Request, res: Response) => {
|
||||
return res.status(200).send({
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return secret with name [secretName] for workspace with id [workspaceId]
|
||||
* and environment [environment]
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
export const getSecretByName = async (req: Request, res: Response) => {
|
||||
return res.status(200).send({
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create secret for workspace with id [workspaceId] and
|
||||
* environment [environment]
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
export const createSecret = async (req: Request, res: Response) => {
|
||||
const { workspaceId } = req.params;
|
||||
|
||||
return res.status(200).send({
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update secret with name [secretName] in workspace with id [workspaceId]
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
export const updateSecretByName = async (req: Request, res: Response) => {
|
||||
|
||||
return res.status(200).send({
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete secret with name [secretName] in workspace with id [workspaceId]
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
export const deleteSecretByName = async (req: Request, res: Response) => {
|
||||
|
||||
return res.status(200).send({
|
||||
|
||||
});
|
||||
}
|
||||
@@ -3,6 +3,46 @@ const router = express.Router();
|
||||
import {
|
||||
requireAuth, validateRequest
|
||||
} from '../../middleware';
|
||||
import { body } from 'express-validator';
|
||||
import { body, param, query } from 'express-validator';
|
||||
import { secretsController } from '../../controllers/v3';
|
||||
|
||||
// note: future endpoints pending brainstorm + implementation
|
||||
|
||||
router.post(
|
||||
'/',
|
||||
body('workspaceId').exists().isString().trim(),
|
||||
body('environment').exists().isString().trim(),
|
||||
secretsController.createSecret
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/',
|
||||
query('workspaceId').exists().isString().trim(),
|
||||
query('environment').exists().isString().trim(),
|
||||
query('tagSlugs'),
|
||||
secretsController.getSecrets
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/:secretName',
|
||||
param('secretName').exists().isString().trim(),
|
||||
secretsController.getSecretByName
|
||||
);
|
||||
|
||||
router.patch(
|
||||
'/:secretName',
|
||||
param('secretName').exists().isString().trim(),
|
||||
query('workspaceId').exists().isString().trim(),
|
||||
validateRequest,
|
||||
secretsController.updateSecretByName
|
||||
);
|
||||
|
||||
router.delete(
|
||||
'/:secretName',
|
||||
param('secretName').exists().isString().trim(),
|
||||
query('workspaceId').exists().isString().trim(),
|
||||
validateRequest,
|
||||
secretsController.deleteSecretByName
|
||||
);
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user